update_authorize_update_batch_finished

Versions
mediamosa-21
update_authorize_update_batch_finished($success, $results)

Batch callback for when the authorized update batch is finished.

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.

Code

modules/update/update.authorize.inc, line 170

<?php
function update_authorize_update_batch_finished($success, $results) {
  foreach ($results['log'] as $project => $messages) {
    if (!empty($messages['#abort'])) {
      $success = FALSE;
    }
  }
  $offline = variable_get('site_offline', 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();

    if ($offline) {
      variable_set('site_offline', 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',
    );
  }

  // 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'];
}
?>