Update core 8.3.0

This commit is contained in:
Rob Davies 2017-04-13 15:53:35 +01:00
parent da7a7918f8
commit cd7a898e66
6144 changed files with 132297 additions and 87747 deletions

View file

@ -36,25 +36,25 @@ use Drupal\Core\Url;
* should use that response for the current page request.
*/
function update_authorize_run_update($filetransfer, $projects) {
$operations = array();
$operations = [];
foreach ($projects as $project_info) {
$operations[] = array(
$operations[] = [
'update_authorize_batch_copy_project',
array(
[
$project_info['project'],
$project_info['updater_name'],
$project_info['local_url'],
$filetransfer,
),
);
],
];
}
$batch = array(
$batch = [
'init_message' => t('Preparing to update your site'),
'operations' => $operations,
'finished' => 'update_authorize_update_batch_finished',
'file' => drupal_get_path('module', 'update') . '/update.authorize.inc',
);
];
batch_set($batch);
// Since authorize.php has its own method for setting the page title, set it
@ -91,30 +91,30 @@ function update_authorize_run_update($filetransfer, $projects) {
* should use that response for the current page request.
*/
function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) {
$operations[] = array(
$operations[] = [
'update_authorize_batch_copy_project',
array(
[
$project,
$updater_name,
$local_url,
$filetransfer,
),
);
],
];
// @todo Instantiate our Updater to set the human-readable title?
$batch = array(
$batch = [
'init_message' => t('Preparing to install'),
'operations' => $operations,
// @todo Use a different finished callback for different messages?
'finished' => 'update_authorize_install_batch_finished',
'file' => drupal_get_path('module', 'update') . '/update.authorize.inc',
);
];
batch_set($batch);
// Since authorize.php has its own method for setting the page title, set it
// manually here rather than passing it in to batch_set() as would normally
// be done.
$_SESSION['authorize_page_title'] = t('Installing %project', array('%project' => $project));
$_SESSION['authorize_page_title'] = t('Installing %project', ['%project' => $project]);
// Invoke the batch via authorize.php.
return system_authorized_batch_process();
@ -142,14 +142,14 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url
// Initialize some variables in the Batch API $context array.
if (!isset($context['results']['log'])) {
$context['results']['log'] = array();
$context['results']['log'] = [];
}
if (!isset($context['results']['log'][$project])) {
$context['results']['log'][$project] = array();
$context['results']['log'][$project] = [];
}
if (!isset($context['results']['tasks'])) {
$context['results']['tasks'] = array();
$context['results']['tasks'] = [];
}
// The batch API uses a session, and since all the arguments are serialized
@ -184,7 +184,7 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url
return;
}
_update_batch_create_message($context['results']['log'][$project], t('Installed %project_name successfully', array('%project_name' => $project)));
_update_batch_create_message($context['results']['log'][$project], t('Installed %project_name successfully', ['%project_name' => $project]));
if (!empty($tasks)) {
$context['results']['tasks'] += $tasks;
}
@ -221,29 +221,29 @@ function update_authorize_update_batch_finished($success, $results) {
// Take the site out of maintenance mode if it was previously that way.
if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = array(
$page_message = [
'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'),
'type' => 'status',
);
];
}
else {
$page_message = array(
$page_message = [
'message' => t('Update was completed successfully.'),
'type' => 'status',
);
];
}
}
elseif (!$offline) {
$page_message = array(
$page_message = [
'message' => t('Update failed! See the log below for more information.'),
'type' => 'error',
);
];
}
else {
$page_message = array(
$page_message = [
'message' => t('Update failed! See the log below for more information. Your site is still in maintenance mode.'),
'type' => 'error',
);
];
}
// Since we're doing an update of existing code, always add a task for
// running update.php.
@ -300,29 +300,29 @@ function update_authorize_install_batch_finished($success, $results) {
// Take the site out of maintenance mode if it was previously that way.
if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
\Drupal::state()->set('system.maintenance_mode', FALSE);
$page_message = array(
$page_message = [
'message' => t('Installation was completed successfully. Your site has been taken out of maintenance mode.'),
'type' => 'status',
);
];
}
else {
$page_message = array(
$page_message = [
'message' => t('Installation was completed successfully.'),
'type' => 'status',
);
];
}
}
elseif (!$success && !$offline) {
$page_message = array(
$page_message = [
'message' => t('Installation failed! See the log below for more information.'),
'type' => 'error',
);
];
}
else {
$page_message = array(
$page_message = [
'message' => t('Installation failed! See the log below for more information. Your site is still in maintenance mode.'),
'type' => 'error',
);
];
}
// Unset the variable since it is no longer needed.
@ -348,7 +348,7 @@ function update_authorize_install_batch_finished($success, $results) {
* if there were errors. Defaults to TRUE.
*/
function _update_batch_create_message(&$project_results, $message, $success = TRUE) {
$project_results[] = array('message' => $message, 'success' => $success);
$project_results[] = ['message' => $message, 'success' => $success];
}
/**