Update to Drupal 8.2.4. For more information, see https://www.drupal.org/project/drupal/releases/8.2.4
This commit is contained in:
parent
0a95b8440e
commit
8544b60b39
284 changed files with 12980 additions and 3199 deletions
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal_ui;
|
||||
namespace Drupal\migrate_drupal_ui\Batch;
|
||||
|
||||
use Drupal\migrate\MigrateMessageInterface;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\migrate_drupal_ui;
|
||||
namespace Drupal\migrate_drupal_ui\Batch;
|
||||
|
||||
use Drupal\Core\Link;
|
||||
use Drupal\Core\StringTranslation\PluralTranslatableMarkup;
|
||||
|
|
@ -18,7 +18,7 @@ use Drupal\migrate\MigrateExecutable;
|
|||
/**
|
||||
* Runs a single migration batch.
|
||||
*/
|
||||
class MigrateUpgradeRunBatch {
|
||||
class MigrateUpgradeImportBatch {
|
||||
|
||||
/**
|
||||
* Maximum number of previous messages to display.
|
||||
|
|
@ -51,33 +51,27 @@ class MigrateUpgradeRunBatch {
|
|||
/**
|
||||
* MigrateMessage instance to capture messages during the migration process.
|
||||
*
|
||||
* @var \Drupal\migrate_drupal_ui\MigrateMessageCapture
|
||||
* @var \Drupal\migrate_drupal_ui\Batch\MigrateMessageCapture
|
||||
*/
|
||||
protected static $messages;
|
||||
|
||||
/**
|
||||
* Runs a single migration batch.
|
||||
* Runs a single migrate batch import.
|
||||
*
|
||||
* @param int[] $initial_ids
|
||||
* The full set of migration IDs to import.
|
||||
* @param string $operation
|
||||
* The operation to perform. Only 'import' is currently supported.
|
||||
* @param array $config
|
||||
* An array of additional configuration from the form.
|
||||
* @param array $context
|
||||
* The batch context.
|
||||
*
|
||||
* @todo Remove the $operation parameter and conditionals for it below, and
|
||||
* refactor this method. https://www.drupal.org/node/2687851
|
||||
*/
|
||||
public static function run($initial_ids, $operation, $config, &$context) {
|
||||
public static function run($initial_ids, $config, &$context) {
|
||||
if (!static::$listenersAdded) {
|
||||
$event_dispatcher = \Drupal::service('event_dispatcher');
|
||||
if ($operation == 'import') {
|
||||
$event_dispatcher->addListener(MigrateEvents::POST_ROW_SAVE, [static::class, 'onPostRowSave']);
|
||||
$event_dispatcher->addListener(MigrateEvents::MAP_SAVE, [static::class, 'onMapSave']);
|
||||
$event_dispatcher->addListener(MigrateEvents::IDMAP_MESSAGE, [static::class, 'onIdMapMessage']);
|
||||
}
|
||||
$event_dispatcher->addListener(MigrateEvents::POST_ROW_SAVE, [static::class, 'onPostRowSave']);
|
||||
$event_dispatcher->addListener(MigrateEvents::MAP_SAVE, [static::class, 'onMapSave']);
|
||||
$event_dispatcher->addListener(MigrateEvents::IDMAP_MESSAGE, [static::class, 'onIdMapMessage']);
|
||||
|
||||
static::$maxExecTime = ini_get('max_execution_time');
|
||||
if (static::$maxExecTime <= 0) {
|
||||
static::$maxExecTime = 60;
|
||||
|
|
@ -98,7 +92,6 @@ class MigrateUpgradeRunBatch {
|
|||
$context['sandbox']['messages'] = [];
|
||||
$context['results']['failures'] = 0;
|
||||
$context['results']['successes'] = 0;
|
||||
$context['results']['operation'] = $operation;
|
||||
}
|
||||
|
||||
// Number processed in this batch.
|
||||
|
|
@ -124,12 +117,10 @@ class MigrateUpgradeRunBatch {
|
|||
$migration_name = $migration->label() ? $migration->label() : $migration_id;
|
||||
|
||||
try {
|
||||
if ($operation == 'import') {
|
||||
$migration_status = $executable->import();
|
||||
}
|
||||
$migration_status = $executable->import();
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
static::logger()->error($e->getMessage());
|
||||
\Drupal::logger('migrate_drupal_ui')->error($e->getMessage());
|
||||
$migration_status = MigrationInterface::RESULT_FAILED;
|
||||
}
|
||||
|
||||
|
|
@ -137,13 +128,11 @@ class MigrateUpgradeRunBatch {
|
|||
case MigrationInterface::RESULT_COMPLETED:
|
||||
// Store the number processed in the sandbox.
|
||||
$context['sandbox']['num_processed'] += static::$numProcessed;
|
||||
if ($operation == 'import') {
|
||||
$message = new PluralTranslatableMarkup(
|
||||
$context['sandbox']['num_processed'], 'Upgraded @migration (processed 1 item total)', 'Upgraded @migration (processed @count items total)',
|
||||
['@migration' => $migration_name]);
|
||||
}
|
||||
$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'][] = (string) $message;
|
||||
static::logger()->notice($message);
|
||||
\Drupal::logger('migrate_drupal_ui')->notice($message);
|
||||
$context['sandbox']['num_processed'] = 0;
|
||||
$context['results']['successes']++;
|
||||
break;
|
||||
|
|
@ -162,12 +151,12 @@ class MigrateUpgradeRunBatch {
|
|||
case MigrationInterface::RESULT_FAILED:
|
||||
$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]);
|
||||
\Drupal::logger('migrate_drupal_ui')->error('Operation on @migration failed', ['@migration' => $migration_name]);
|
||||
break;
|
||||
|
||||
case MigrationInterface::RESULT_SKIPPED:
|
||||
$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]);
|
||||
\Drupal::logger('migrate_drupal_ui')->error('Operation on @migration skipped due to unfulfilled dependencies', ['@migration' => $migration_name]);
|
||||
break;
|
||||
|
||||
case MigrationInterface::RESULT_DISABLED:
|
||||
|
|
@ -184,7 +173,7 @@ class MigrateUpgradeRunBatch {
|
|||
// Add and log any captured messages.
|
||||
foreach (static::$messages->getMessages() as $message) {
|
||||
$context['sandbox']['messages'][] = (string) $message;
|
||||
static::logger()->error($message);
|
||||
\Drupal::logger('migrate_drupal_ui')->error($message);
|
||||
}
|
||||
|
||||
// Only display the last MESSAGE_LENGTH messages, in reverse order.
|
||||
|
|
@ -203,13 +192,11 @@ class MigrateUpgradeRunBatch {
|
|||
$migration_id = reset($context['sandbox']['migration_ids']);
|
||||
$migration = \Drupal::service('plugin.manager.migration')->createInstance($migration_id);
|
||||
$migration_name = $migration->label() ? $migration->label() : $migration_id;
|
||||
if ($operation == 'import') {
|
||||
$context['message'] = (string) new TranslatableMarkup('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'],
|
||||
]) . "<br />\n" . $context['message'];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
@ -221,52 +208,36 @@ class MigrateUpgradeRunBatch {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns the logger using the migrate_drupal_ui channel.
|
||||
* Callback executed when the Migrate Upgrade Import batch process completes.
|
||||
*
|
||||
* @return \Psr\Log\LoggerInterface
|
||||
* The logger instance.
|
||||
*/
|
||||
protected static function logger() {
|
||||
return \Drupal::logger('migrate_drupal_ui');
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements the Batch API finished method.
|
||||
* @param bool $success
|
||||
* TRUE if batch successfully completed.
|
||||
* @param array $results
|
||||
* Batch results.
|
||||
* @param array $operations
|
||||
* An array of methods run in the batch.
|
||||
* @param string $elapsed
|
||||
* The time to run the batch.
|
||||
*/
|
||||
public static function finished($success, $results, $operations, $elapsed) {
|
||||
static::displayResults($results);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays counts of success/failures on the migration upgrade complete page.
|
||||
*
|
||||
* @param array $results
|
||||
* An array of result data built during the batch.
|
||||
*/
|
||||
protected static function displayResults($results) {
|
||||
$successes = $results['successes'];
|
||||
$failures = $results['failures'];
|
||||
|
||||
// If we had any successes log that for the user.
|
||||
if ($successes > 0) {
|
||||
if ($results['operation'] == 'import') {
|
||||
drupal_set_message(new PluralTranslatableMarkup($successes, 'Completed 1 upgrade task successfully', 'Completed @count upgrade tasks successfully'));
|
||||
}
|
||||
drupal_set_message(\Drupal::translation()
|
||||
->formatPlural($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(new PluralTranslatableMarkup($failures, '1 upgrade failed', '@count upgrades failed'));
|
||||
drupal_set_message(new TranslatableMarkup('Upgrade process not completed'), 'error');
|
||||
}
|
||||
drupal_set_message(\Drupal::translation()
|
||||
->formatPlural($failures, '1 upgrade failed', '@count upgrades failed'));
|
||||
drupal_set_message(t('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(new TranslatableMarkup('Congratulations, you upgraded Drupal!'));
|
||||
}
|
||||
// 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!'));
|
||||
}
|
||||
|
||||
if (\Drupal::moduleHandler()->moduleExists('dblog')) {
|
||||
|
|
@ -335,7 +306,7 @@ class MigrateUpgradeRunBatch {
|
|||
$type = 'error';
|
||||
}
|
||||
$source_id_string = implode(',', $event->getSourceIdValues());
|
||||
$message = new TranslatableMarkup('Source ID @source_id: @message', ['@source_id' => $source_id_string, '@message' => $event->getMessage()]);
|
||||
$message = t('Source ID @source_id: @message', ['@source_id' => $source_id_string, '@message' => $event->getMessage()]);
|
||||
static::$messages->display($message, $type);
|
||||
}
|
||||
|
||||
|
|
@ -9,7 +9,7 @@ use Drupal\Core\Render\RendererInterface;
|
|||
use Drupal\Core\State\StateInterface;
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
|
||||
use Drupal\migrate_drupal_ui\MigrateUpgradeRunBatch;
|
||||
use Drupal\migrate_drupal_ui\Batch\MigrateUpgradeImportBatch;
|
||||
use Drupal\migrate_drupal\MigrationConfigurationTrait;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
|
|
@ -258,6 +258,10 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
'source_module' => 'forum',
|
||||
'destination_module' => 'forum',
|
||||
],
|
||||
'd7_global_theme_settings' => [
|
||||
'source_module' => 'system',
|
||||
'destination_module' => 'system',
|
||||
],
|
||||
'd6_imagecache_presets' => [
|
||||
'source_module' => 'imagecache',
|
||||
'destination_module' => 'image',
|
||||
|
|
@ -278,14 +282,30 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'd6_language_negotiation_settings' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'd7_language_negotiation_settings' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'language_prefixes_and_domains' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'd6_language_types' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'language' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'd7_language_types' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'language',
|
||||
],
|
||||
'locale_settings' => [
|
||||
'source_module' => 'locale',
|
||||
'destination_module' => 'locale',
|
||||
|
|
@ -744,7 +764,7 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
$form['upgrade_option_item'] = [
|
||||
'#type' => 'item',
|
||||
'#prefix' => $this->t('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal 8. Rollbacks and incremental migrations are not yet supported through the user interface. For more information, see the <a href=":url">upgrading handbook</a>.', [':url' => 'https://www.drupal.org/upgrade/migrate']),
|
||||
'#description' => $this->t('<p>Last upgrade: @date</p>', ['@date' => $this->dateFormatter->format($date_performed)]),
|
||||
'#description' => $this->t('Last upgrade: @date', ['@date' => $this->dateFormatter->format($date_performed)]),
|
||||
];
|
||||
return $form;
|
||||
}
|
||||
|
|
@ -961,16 +981,10 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
}
|
||||
catch (\Exception $e) {
|
||||
$error_message = [
|
||||
'#type' => 'inline_template',
|
||||
'#template' => '{% trans %}Resolve the issue below to continue the upgrade.{% endtrans%}{{ errors }}',
|
||||
'#context' => [
|
||||
'errors' => [
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [$e->getMessage()],
|
||||
],
|
||||
],
|
||||
'#title' => $this->t('Resolve the issue below to continue the upgrade.'),
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [$e->getMessage()],
|
||||
];
|
||||
|
||||
$form_state->setErrorByName($database['driver'] . '][0', $this->renderer->renderPlain($error_message));
|
||||
}
|
||||
}
|
||||
|
|
@ -1083,8 +1097,12 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
];
|
||||
}
|
||||
$form['counts'] = [
|
||||
'#type' => 'item',
|
||||
'#title' => '<ul><li>' . $this->t('@count available upgrade paths', ['@count' => $available_count]) . '</li><li>' . $this->t('@count missing upgrade paths', ['@count' => $missing_count]) . '</li></ul>',
|
||||
'#title' => 'Upgrade analysis report',
|
||||
'#theme' => 'item_list',
|
||||
'#items' => [
|
||||
$this->formatPlural($available_count, '@count available upgrade path', '@count available upgrade paths'),
|
||||
$this->formatPlural($missing_count, '@count missing upgrade path', '@count missing upgrade paths'),
|
||||
],
|
||||
'#weight' => -15,
|
||||
];
|
||||
|
||||
|
|
@ -1109,13 +1127,12 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
'progress_message' => '',
|
||||
'operations' => [
|
||||
[
|
||||
[MigrateUpgradeRunBatch::class, 'run'],
|
||||
[array_keys($migrations), 'import', $config],
|
||||
[MigrateUpgradeImportBatch::class, 'run'],
|
||||
[array_keys($migrations), $config],
|
||||
],
|
||||
],
|
||||
'finished' => [
|
||||
MigrateUpgradeRunBatch::class,
|
||||
'finished',
|
||||
MigrateUpgradeImportBatch::class, 'finished',
|
||||
],
|
||||
];
|
||||
batch_set($batch);
|
||||
|
|
@ -1153,7 +1170,9 @@ class MigrateUpgradeForm extends ConfirmFormBase {
|
|||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDescription() {
|
||||
return $this->t('<p><strong>Upgrade analysis report</strong></p>');
|
||||
// The description is added by the buildConfirmForm() method.
|
||||
// @see \Drupal\migrate_drupal_ui\Form\MigrateUpgradeForm::buildConfirmForm()
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
|
|||
'image_style' => 5,
|
||||
'language_content_settings' => 2,
|
||||
'migration' => 105,
|
||||
'node' => 10,
|
||||
'node' => 11,
|
||||
'node_type' => 11,
|
||||
'rdf_mapping' => 5,
|
||||
'search_page' => 2,
|
||||
|
|
@ -58,7 +58,7 @@ class MigrateUpgrade6Test extends MigrateUpgradeTestBase {
|
|||
'action' => 22,
|
||||
'menu' => 8,
|
||||
'taxonomy_term' => 6,
|
||||
'taxonomy_vocabulary' => 6,
|
||||
'taxonomy_vocabulary' => 5,
|
||||
'tour' => 4,
|
||||
'user' => 7,
|
||||
'user_role' => 6,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ class MigrateUpgrade7Test extends MigrateUpgradeTestBase {
|
|||
'configurable_language' => 4,
|
||||
'contact_form' => 3,
|
||||
'editor' => 2,
|
||||
'field_config' => 45,
|
||||
'field_storage_config' => 33,
|
||||
'field_config' => 48,
|
||||
'field_storage_config' => 36,
|
||||
'file' => 1,
|
||||
'filter_format' => 7,
|
||||
'image_style' => 6,
|
||||
|
|
|
|||
Reference in a new issue