function update_authorize_update_batch_finished
Same name in other branches
- 9 core/modules/update/update.authorize.inc \update_authorize_update_batch_finished()
- 8.9.x core/modules/update/update.authorize.inc \update_authorize_update_batch_finished()
- 10 core/modules/update/update.authorize.inc \update_authorize_update_batch_finished()
- 11.x core/modules/update/update.authorize.inc \update_authorize_update_batch_finished()
Implements callback_batch_finished().
Performs actions when the authorized update batch is done.
This processes the results and stashes them into SESSION such that authorize.php will render a report. Also responsible for putting the site back online and clearing the update status cache after a successful update.
Parameters
$success: TRUE if the batch operation was successful; FALSE if there were errors.
$results: An associative array of results from the batch operation.
1 string reference to 'update_authorize_update_batch_finished'
- update_authorize_run_update in modules/
update/ update.authorize.inc - Updates existing projects when invoked by authorize.php.
File
-
modules/
update/ update.authorize.inc, line 186
Code
function update_authorize_update_batch_finished($success, $results) {
foreach ($results['log'] as $project => $messages) {
if (!empty($messages['#abort'])) {
$success = FALSE;
}
}
$offline = variable_get('maintenance_mode', FALSE);
if ($success) {
// Now that the update completed, we need to clear the cache of available
// update data and recompute our status, so prevent show bogus results.
_update_authorize_clear_update_status();
// Take the site out of maintenance mode if it was previously that way.
if ($offline && isset($_SESSION['maintenance_mode']) && $_SESSION['maintenance_mode'] == FALSE) {
variable_set('maintenance_mode', FALSE);
$page_message = array(
'message' => t('Update was completed successfully. Your site has been taken out of maintenance mode.'),
'type' => 'status',
);
}
else {
$page_message = array(
'message' => t('Update was completed successfully.'),
'type' => 'status',
);
}
}
elseif (!$offline) {
$page_message = array(
'message' => t('Update failed! See the log below for more information.'),
'type' => 'error',
);
}
else {
$page_message = array(
'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.
$results['tasks'][] = t('Your modules have been downloaded and updated.');
$results['tasks'][] = t('<a href="@update">Run database updates</a>', array(
'@update' => base_path() . 'update.php',
));
// Unset the variable since it is no longer needed.
unset($_SESSION['maintenance_mode']);
// Set all these values into the SESSION so authorize.php can display them.
$_SESSION['authorize_results']['success'] = $success;
$_SESSION['authorize_results']['page_message'] = $page_message;
$_SESSION['authorize_results']['messages'] = $results['log'];
$_SESSION['authorize_results']['tasks'] = $results['tasks'];
$_SESSION['authorize_operation']['page_title'] = t('Update manager');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.