function update_authorize_run_update
Same name in other branches
- 7.x modules/update/update.authorize.inc \update_authorize_run_update()
- 9 core/modules/update/update.authorize.inc \update_authorize_run_update()
- 8.9.x core/modules/update/update.authorize.inc \update_authorize_run_update()
- 10 core/modules/update/update.authorize.inc \update_authorize_run_update()
Updates existing projects when invoked by authorize.php.
Callback for system_authorized_init() in update_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 Drupal\Core\Updater\Updater class to use for this project.
- local_url: The locally installed location of new code to update with.
Return value
\Symfony\Component\HttpFoundation\Response|null The result of processing the batch that updates the projects. If this is an instance of \Symfony\Component\HttpFoundation\Response the calling code should use that response for the current page request.
1 call to update_authorize_run_update()
- UpdateReady::submitForm in core/
modules/ update/ src/ Form/ UpdateReady.php - Form submission handler.
1 string reference to 'update_authorize_run_update'
- UpdateReady::submitForm in core/
modules/ update/ src/ Form/ UpdateReady.php - Form submission handler.
File
-
core/
modules/ update/ update.authorize.inc, line 39
Code
function update_authorize_run_update($filetransfer, $projects) {
$batch_builder = (new BatchBuilder())->setFile(\Drupal::service('extension.list.module')->getPath('update') . '/update.authorize.inc')
->setInitMessage(t('Preparing to update your site'))
->setFinishCallback('update_authorize_update_batch_finished');
foreach ($projects as $project_info) {
$batch_builder->addOperation('update_authorize_batch_copy_project', [
$project_info['project'],
$project_info['updater_name'],
$project_info['local_url'],
$filetransfer,
]);
}
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('Downloading updates'));
// 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.