1 installer.authorize.inc installer_authorize_run_update($filetransfer, $projects)

Updates existing projects when invoked by authorize.php.

Callback for system_authorized_init() in installer_manager_update_ready_form_submit().

Parameters

$filetransfer: The FileTransfer object created by authorize.php for use during this operation.

$projects: A nested array of projects to install into the live webroot, keyed by project name. Each subarray contains the following keys:

  • project: The canonical project short name.
  • updater_name: The name of the Updater class to use for this project.
  • local_url: The locally installed location of new code to update with.

File

core/modules/installer/installer.authorize.inc, line 28
Callbacks and related functions invoked by authorize.php to update projects.

Code

function installer_authorize_run_update($filetransfer, $projects) {
  $operations = array();
  foreach ($projects as $project => $project_info) {
    if ($project_info['project'] == 'backdrop') {
      $updater_name = 'CoreUpdater';
    }
    else {
      $updater_name = $project_info['updater_name'];
    }

    $operations[] = array(
      'installer_authorize_batch_copy_project',
      array(
        $project_info['project'],
        $updater_name,
        $project_info['local_url'],
        $filetransfer,
      ),
    );
  }

  $batch = array(
    'title' => t('Installing updates'),
    'init_message' => t('Preparing to update your site'),
    'operations' => $operations,
    'finished' => 'installer_authorize_update_batch_finished',
    'file' => backdrop_get_path('module', 'installer') . '/installer.authorize.inc',
  );

  batch_set($batch);
  // Invoke the batch via authorize.php.
  system_authorized_batch_process();
}