You are here

function update_manager_download_batch_finished in Drupal 7

Same name and namespace in other branches
  1. 8 core/modules/update/update.manager.inc \update_manager_download_batch_finished()
  2. 9 core/modules/update/update.manager.inc \update_manager_download_batch_finished()
  3. 10 core/modules/update/update.manager.inc \update_manager_download_batch_finished()

Implements callback_batch_finished().

Batch callback: Performs actions when the download batch is completed.

Parameters

$success: TRUE if the batch operation was successful, FALSE if there were errors.

$results: An associative array of results from the batch operation.

Related topics

1 string reference to 'update_manager_download_batch_finished'
update_manager_update_form_submit in modules/update/update.manager.inc
Form submission handler for update_manager_update_form().

File

modules/update/update.manager.inc, line 347
Administrative screens and processing functions of the Update Manager module.

Code

function update_manager_download_batch_finished($success, $results) {
  if (!empty($results['errors'])) {
    $error_list = array(
      'title' => t('Downloading updates failed:'),
      'items' => $results['errors'],
    );
    drupal_set_message(theme('item_list', $error_list), 'error');
  }
  elseif ($success) {
    drupal_set_message(t('Updates downloaded successfully.'));
    $_SESSION['update_manager_update_projects'] = $results['projects'];
    drupal_goto('admin/update/ready');
  }
  else {

    // Ideally we're catching all Exceptions, so they should never see this,
    // but just in case, we have to tell them something.
    drupal_set_message(t('Fatal error trying to download.'), 'error');
  }
}