Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0

This commit is contained in:
Pantheon Automation 2016-10-06 15:16:20 -07:00 committed by Greg Anderson
parent 2f563ab520
commit f1c8716f57
1732 changed files with 52334 additions and 11780 deletions

View file

@ -30,7 +30,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
* @var array[]
*/
protected $moduleUpgradePaths = [
'd6_action_settings' => [
'action_settings' => [
'source_module' => 'system',
'destination_module' => 'action',
],
@ -170,6 +170,10 @@ class MigrateUpgradeForm extends ConfirmFormBase {
'source_module' => 'dblog',
'destination_module' => 'dblog',
],
'default_language' => [
'source_module' => 'locale',
'destination_module' => 'language',
],
'd6_field' => [
'source_module' => 'content',
'destination_module' => 'field',
@ -210,7 +214,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
'source_module' => 'system',
'destination_module' => 'file',
],
'd6_file_settings' => [
'file_settings' => [
'source_module' => 'system',
'destination_module' => 'file',
],
@ -418,19 +422,19 @@ class MigrateUpgradeForm extends ConfirmFormBase {
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_image' => [
'system_image' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_image_gd' => [
'system_image_gd' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_logging' => [
'system_logging' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_maintenance' => [
'system_maintenance' => [
'source_module' => 'system',
'destination_module' => 'system',
],
@ -438,11 +442,35 @@ class MigrateUpgradeForm extends ConfirmFormBase {
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_rss' => [
'system_rss' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd6_system_site' => [
'system_site' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_authorize' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_cron' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_date' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_file' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_mail' => [
'source_module' => 'system',
'destination_module' => 'system',
],
'd7_system_performance' => [
'source_module' => 'system',
'destination_module' => 'system',
],
@ -699,7 +727,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
* The form structure.
*/
public function buildOverviewForm(array $form, FormStateInterface $form_state) {
$form['#title'] = $this->t('Drupal Upgrade');
$form['#title'] = $this->t('Upgrade');
if ($date_performed = $this->state->get('migrate_drupal_ui.performed')) {
// @todo Add back support for rollbacks and incremental migrations.
@ -714,7 +742,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
}
else {
$form['info_header'] = [
'#markup' => '<p>' . $this->t('Upgrade a Drupal site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the <a href=":url">upgrading handbook</a> for more detailed information.', [
'#markup' => '<p>' . $this->t('Upgrade a site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the <a href=":url">online documentation for Drupal site upgrades</a> for more detailed information.', [
':url' => 'https://www.drupal.org/upgrade/migrate',
]),
];
@ -850,7 +878,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
$form['source']['source_base_path'] = [
'#type' => 'textfield',
'#title' => $this->t('Files directory'),
'#description' => $this->t('To import files from your current Drupal site, enter a local file directory containing your site (e.g. /var/www/docroot), or your site address (e.g. http://example.com).'),
'#description' => $this->t('To import files from your current Drupal site, enter a local file directory containing your site (e.g. /var/www/docroot), or your site address (for example http://example.com).'),
];
$form['actions'] = ['#type' => 'actions'];

View file

@ -3,6 +3,8 @@
namespace Drupal\migrate_drupal_ui;
use Drupal\Core\Link;
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Event\MigrateEvents;
@ -103,18 +105,18 @@ class MigrateUpgradeRunBatch {
static::$numProcessed = 0;
$migration_id = reset($context['sandbox']['migration_ids']);
/** @var \Drupal\migrate\Plugin\Migration $migration */
$migration = \Drupal::service('plugin.manager.migration')->createInstance($migration_id);
$definition = \Drupal::service('plugin.manager.migration')->getDefinition($migration_id);
$configuration = [];
// @TODO, remove this in https://www.drupal.org/node/2681869.
$destination = $migration->getDestinationConfiguration();
if ($destination['plugin'] === 'entity:file') {
// @todo Find a way to avoid this in https://www.drupal.org/node/2804611.
if ($definition['destination']['plugin'] === 'entity:file') {
// Make sure we have a single trailing slash.
$source_base_path = rtrim($config['source_base_path'], '/') . '/';
$destination['source_base_path'] = $source_base_path;
$migration->set('destination', $destination);
$configuration['source']['constants']['source_base_path'] = rtrim($config['source_base_path'], '/') . '/';
}
/** @var \Drupal\migrate\Plugin\Migration $migration */
$migration = \Drupal::service('plugin.manager.migration')->createInstance($migration_id, $configuration);
if ($migration) {
static::$messages = new MigrateMessageCapture();
$executable = new MigrateExecutable($migration, static::$messages);
@ -136,35 +138,35 @@ class MigrateUpgradeRunBatch {
// Store the number processed in the sandbox.
$context['sandbox']['num_processed'] += static::$numProcessed;
if ($operation == 'import') {
$message = static::getTranslation()->formatPlural(
$context['sandbox']['num_processed'], 'Upgraded @migration (processed 1 item total)', 'Upgraded @migration (processed @num_processed items total)',
['@migration' => $migration_name, '@num_processed' => $context['sandbox']['num_processed']]);
$message = new PluralTranslatableMarkup(
$context['sandbox']['num_processed'], 'Upgraded @migration (processed 1 item total)', 'Upgraded @migration (processed @count items total)',
['@migration' => $migration_name]);
}
$context['sandbox']['messages'][] = $message;
$context['sandbox']['messages'][] = (string) $message;
static::logger()->notice($message);
$context['sandbox']['num_processed'] = 0;
$context['results']['successes']++;
break;
case MigrationInterface::RESULT_INCOMPLETE:
$context['sandbox']['messages'][] = static::getTranslation()->formatPlural(
static::$numProcessed, 'Continuing with @migration (processed 1 item)', 'Continuing with @migration (processed @num_processed items)',
['@migration' => $migration_name, '@num_processed' => static::$numProcessed]);
$context['sandbox']['messages'][] = (string) new PluralTranslatableMarkup(
static::$numProcessed, 'Continuing with @migration (processed 1 item)', 'Continuing with @migration (processed @count items)',
['@migration' => $migration_name]);
$context['sandbox']['num_processed'] += static::$numProcessed;
break;
case MigrationInterface::RESULT_STOPPED:
$context['sandbox']['messages'][] = t('Operation stopped by request');
$context['sandbox']['messages'][] = (string) new TranslatableMarkup('Operation stopped by request');
break;
case MigrationInterface::RESULT_FAILED:
$context['sandbox']['messages'][] = t('Operation on @migration failed', ['@migration' => $migration_name]);
$context['sandbox']['messages'][] = (string) new TranslatableMarkup('Operation on @migration failed', ['@migration' => $migration_name]);
$context['results']['failures']++;
static::logger()->error('Operation on @migration failed', ['@migration' => $migration_name]);
break;
case MigrationInterface::RESULT_SKIPPED:
$context['sandbox']['messages'][] = t('Operation on @migration skipped due to unfulfilled dependencies', ['@migration' => $migration_name]);
$context['sandbox']['messages'][] = (string) new TranslatableMarkup('Operation on @migration skipped due to unfulfilled dependencies', ['@migration' => $migration_name]);
static::logger()->error('Operation on @migration skipped due to unfulfilled dependencies', ['@migration' => $migration_name]);
break;
@ -181,7 +183,7 @@ class MigrateUpgradeRunBatch {
// Add and log any captured messages.
foreach (static::$messages->getMessages() as $message) {
$context['sandbox']['messages'][] = $message;
$context['sandbox']['messages'][] = (string) $message;
static::logger()->error($message);
}
@ -202,7 +204,7 @@ class MigrateUpgradeRunBatch {
$migration = \Drupal::service('plugin.manager.migration')->createInstance($migration_id);
$migration_name = $migration->label() ? $migration->label() : $migration_id;
if ($operation == 'import') {
$context['message'] = t('Currently upgrading @migration (@current of @max total tasks)', [
$context['message'] = (string) new TranslatableMarkup('Currently upgrading @migration (@current of @max total tasks)', [
'@migration' => $migration_name,
'@current' => $context['sandbox']['current'],
'@max' => $context['sandbox']['max'],
@ -228,16 +230,6 @@ class MigrateUpgradeRunBatch {
return \Drupal::logger('migrate_drupal_ui');
}
/**
* Wraps the translation manager.
*
* @return \Drupal\Core\StringTranslation\TranslationManager
* The string translation manager.
*/
protected static function getTranslation() {
return \Drupal::translation();
}
/**
* Implements the Batch API finished method.
*/
@ -258,28 +250,28 @@ class MigrateUpgradeRunBatch {
// If we had any successes log that for the user.
if ($successes > 0) {
if ($results['operation'] == 'import') {
drupal_set_message(static::getTranslation()->formatPlural($successes, 'Completed 1 upgrade task successfully', 'Completed @count upgrade tasks successfully'));
drupal_set_message(new PluralTranslatableMarkup($successes, 'Completed 1 upgrade task successfully', 'Completed @count upgrade tasks successfully'));
}
}
// If we had failures, log them and show the migration failed.
if ($failures > 0) {
if ($results['operation'] == 'import') {
drupal_set_message(static::getTranslation()->formatPlural($failures, '1 upgrade failed', '@count upgrades failed'));
drupal_set_message(t('Upgrade process not completed'), 'error');
drupal_set_message(new PluralTranslatableMarkup($failures, '1 upgrade failed', '@count upgrades failed'));
drupal_set_message(new TranslatableMarkup('Upgrade process not completed'), 'error');
}
}
else {
if ($results['operation'] == 'import') {
// Everything went off without a hitch. We may not have had successes
// but we didn't have failures so this is fine.
drupal_set_message(t('Congratulations, you upgraded Drupal!'));
drupal_set_message(new TranslatableMarkup('Congratulations, you upgraded Drupal!'));
}
}
if (\Drupal::moduleHandler()->moduleExists('dblog')) {
$url = Url::fromRoute('migrate_drupal_ui.log');
drupal_set_message(Link::fromTextAndUrl(t('Review the detailed upgrade log'), $url), $failures ? 'error' : 'status');
drupal_set_message(Link::fromTextAndUrl(new TranslatableMarkup('Review the detailed upgrade log'), $url), $failures ? 'error' : 'status');
}
}
@ -343,7 +335,7 @@ class MigrateUpgradeRunBatch {
$type = 'error';
}
$source_id_string = implode(',', $event->getSourceIdValues());
$message = t('Source ID @source_id: @message', ['@source_id' => $source_id_string, '@message' => $event->getMessage()]);
$message = new TranslatableMarkup('Source ID @source_id: @message', ['@source_id' => $source_id_string, '@message' => $event->getMessage()]);
static::$messages->display($message, $type);
}

View file

@ -25,13 +25,13 @@ class MigrateAccessTest extends WebTestBase {
$this->drupalLogin($this->rootUser);
$this->drupalGet('upgrade');
$this->assertResponse(200);
$this->assertText(t('Drupal Upgrade'));
$this->assertText(t('Upgrade'));
$user = $this->createUser(['administer software updates']);
$this->drupalLogin($user);
$this->drupalGet('upgrade');
$this->assertResponse(403);
$this->assertNoText(t('Drupal Upgrade'));
$this->assertNoText(t('Upgrade'));
}
}

View file

@ -104,7 +104,7 @@ abstract class MigrateUpgradeTestBase extends WebTestBase {
protected function testMigrateUpgrade() {
$connection_options = $this->sourceDatabase->getConnectionOptions();
$this->drupalGet('/upgrade');
$this->assertText('Upgrade a Drupal site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the upgrading handbook for more detailed information.');
$this->assertText('Upgrade a site by importing it into a clean and empty new install of Drupal 8. You will lose any existing configuration once you import your site into it. See the online documentation for Drupal site upgrades for more detailed information.');
$this->drupalPostForm(NULL, [], t('Continue'));
$this->assertText('Provide credentials for the database of the Drupal site you want to upgrade.');
@ -174,6 +174,7 @@ abstract class MigrateUpgradeTestBase extends WebTestBase {
}
}
}
\Drupal::service('module_installer')->install(['forum']);
}
/**

View file

@ -43,13 +43,13 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
'configurable_language' => 4,
'contact_form' => 3,
'editor' => 2,
'field_config' => 43,
'field_storage_config' => 32,
'field_config' => 44,
'field_storage_config' => 33,
'file' => 1,
'filter_format' => 7,
'image_style' => 6,
'language_content_settings' => 2,
'migration' => 59,
'migration' => 73,
'node' => 3,
'node_type' => 6,
'rdf_mapping' => 5,