function update_authorize_run_install

Same name in other branches
  1. 7.x modules/update/update.authorize.inc \update_authorize_run_install()
  2. 8.9.x core/modules/update/update.authorize.inc \update_authorize_run_install()
  3. 10 core/modules/update/update.authorize.inc \update_authorize_run_install()

Installs a new project when invoked by authorize.php.

Callback for system_authorized_init() in update_manager_install_form_submit().

Parameters

\Drupal\Core\FileTransfer\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.

1 string reference to 'update_authorize_run_install'
UpdateManagerInstall::submitForm in core/modules/update/src/Form/UpdateManagerInstall.php
Form submission handler.

File

core/modules/update/update.authorize.inc, line 89

Code

function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) {
    // @todo Instantiate our Updater to set the human-readable title?
    $batch_builder = (new BatchBuilder())->setFile(\Drupal::service('extension.list.module')->getPath('update') . '/update.authorize.inc')
        ->setInitMessage(t('Preparing to install'))
        ->addOperation('update_authorize_batch_copy_project', [
        $project,
        $updater_name,
        $local_url,
        $filetransfer,
    ])
        ->setFinishCallback('update_authorize_install_batch_finished');
    batch_set($batch_builder->toArray());
    // 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.
    \Drupal::request()->getSession()
        ->set('authorize_page_title', t('Adding %project', [
        '%project' => $project,
    ]));
    // Invoke the batch via authorize.php.
    return system_authorized_batch_process();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.