update_authorize_run_install

update_authorize_run_install($filetransfer, $project, $updater_name, $local_url)

Installs a new project when invoked by authorize.php.

Callback for system_authorized_init() in update_manager_install_form_submit().

Parameters

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

string $project: The canonical project short name; i.e., the name of the module, theme, or profile.

string $updater_name: The name of the Drupal\Core\Updater\Updater class to use for installing this project.

string $local_url: The URL to the locally installed temp directory where the project has already been downloaded and extracted into.

Return value

\Symfony\Component\HttpFoundation\Response|null The result of processing the batch that installs the project. If this is an instance of \Symfony\Component\HttpFoundation\Response the calling code should use that response for the current page request.

File

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

Code

function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) {
  $operations[] = array(
    'update_authorize_batch_copy_project',
    array(
      $project,
      $updater_name,
      $local_url,
      $filetransfer,
    ),
  );

  // @todo Instantiate our Updater to set the human-readable title?
  $batch = array(
    '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));

  // Invoke the batch via authorize.php.
  return system_authorized_batch_process();
}
doc_Drupal
2016-10-29 09:51:19
Comments
Leave a Comment

Please login to continue.