Update to Drupal 8.0.0-beta15. For more information, see: https://www.drupal.org/node/2563023

This commit is contained in:
Pantheon Automation 2015-09-04 13:20:09 -07:00 committed by Greg Anderson
parent 2720a9ec4b
commit f3791f1da3
1898 changed files with 54300 additions and 11481 deletions

View file

@ -11,6 +11,7 @@
*/
use Drupal\Core\Updater\UpdaterException;
use Drupal\Core\Url;
/**
* Updates existing projects when invoked by authorize.php.
@ -28,6 +29,11 @@ use Drupal\Core\Updater\UpdaterException;
* - 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 \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.
*/
function update_authorize_run_update($filetransfer, $projects) {
$operations = array();
@ -44,14 +50,18 @@ function update_authorize_run_update($filetransfer, $projects) {
}
$batch = array(
'title' => t('Installing updates'),
'init_message' => t('Preparing to update your site'),
'operations' => $operations,
'finished' => 'update_authorize_update_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 updates');
// Invoke the batch via authorize.php.
return system_authorized_batch_process();
}
@ -74,6 +84,11 @@ function update_authorize_run_update($filetransfer, $projects) {
* @param string $local_url
* The URL to the locally installed temp directory where the project has
* already been downloaded and extracted into.
*
* @return \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.
*/
function update_authorize_run_install($filetransfer, $project, $updater_name, $local_url) {
$operations[] = array(
@ -88,7 +103,6 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l
// @todo Instantiate our Updater to set the human-readable title?
$batch = array(
'title' => t('Installing %project', array('%project' => $project)),
'init_message' => t('Preparing to install'),
'operations' => $operations,
// @todo Use a different finished callback for different messages?
@ -97,6 +111,11 @@ function update_authorize_run_install($filetransfer, $project, $updater_name, $l
);
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();
}
@ -147,7 +166,7 @@ function update_authorize_batch_copy_project($project, $updater_name, $local_url
return;
}
$updater = new $updater_name($local_url);
$updater = new $updater_name($local_url, \Drupal::getContainer()->get('update.root'));
try {
if ($updater->isInstalled()) {
@ -229,7 +248,19 @@ function update_authorize_update_batch_finished($success, $results) {
// Since we're doing an update of existing code, always add a task for
// running update.php.
$results['tasks'][] = t('Your modules have been downloaded and updated.');
$results['tasks'][] = t('<a href="@update">Run database updates</a>', array('@update' => \Drupal::url('system.db_update')));
$results['tasks'][] = [
'#type' => 'link',
'#url' => Url::fromRoute('system.db_update'),
'#title' => t('Run database updates'),
// Since this is being called outsite of the primary front controller,
// the base_url needs to be set explicitly to ensure that links are
// relative to the site root.
// @todo Simplify with https://www.drupal.org/node/2548095
'#options' => [
'absolute' => TRUE,
'base_url' => $GLOBALS['base_url'],
],
];
// Unset the variable since it is no longer needed.
unset($_SESSION['maintenance_mode']);
@ -239,6 +270,7 @@ function update_authorize_update_batch_finished($success, $results) {
$_SESSION['authorize_results']['page_message'] = $page_message;
$_SESSION['authorize_results']['messages'] = $results['log'];
$_SESSION['authorize_results']['tasks'] = $results['tasks'];
$_SESSION['authorize_page_title'] = t('Update manager');
}
/**
@ -299,6 +331,7 @@ function update_authorize_install_batch_finished($success, $results) {
$_SESSION['authorize_results']['page_message'] = $page_message;
$_SESSION['authorize_results']['messages'] = $results['log'];
$_SESSION['authorize_results']['tasks'] = $results['tasks'];
$_SESSION['authorize_page_title'] = t('Update manager');
}
/**