diff --git a/core/modules/migrate_drupal/src/MigrationCreationTrait.php b/core/modules/migrate_drupal/src/MigrationCreationTrait.php index 412ed09..fa08e4b 100644 --- a/core/modules/migrate_drupal/src/MigrationCreationTrait.php +++ b/core/modules/migrate_drupal/src/MigrationCreationTrait.php @@ -66,17 +66,20 @@ protected function getSystemData(array $database) { /** * Sets up the relevant migrations for import from a database connection. * - * @param array|\Drupal\Core\Database\Database $database + * @param array $database * Database array representing the source Drupal database. * @param string $source_base_path - * Address of the source Drupal site (e.g., http://example.com/). + * (Optional) Address of the source Drupal site (e.g., http://example.com/). * - * @return int[] - * An array of Migration entity IDs. + * @return array + * An array of the migration templates (parsed YAML config arrays) that were + * tagged for the identified source Drupal version. The templates are + * populated with database state key and file source base path information + * for execution. The array is keyed by migration IDs. * * @throws \Exception */ - protected function getMigrationTemplates(array $database, $source_base_path) { + protected function getMigrationTemplates(array $database, $source_base_path = '') { // Set up the connection. $connection = $this->getConnection($database); if (!$drupal_version = $this->getLegacyDrupalVersion($connection)) { @@ -112,7 +115,7 @@ protected function getMigrationTemplates(array $database, $source_base_path) { * migrations are returned. * * @param array $migration_templates - * Migration template. + * Migration templates (parsed YAML config arrays), keyed by the ID. * * @return \Drupal\migrate\Entity\MigrationInterface[] * The migrations for import. diff --git a/core/modules/migrate_drupal_ui/migrate_drupal_ui.install b/core/modules/migrate_drupal_ui/migrate_drupal_ui.install index 6594ba6..8fb0783 100644 --- a/core/modules/migrate_drupal_ui/migrate_drupal_ui.install +++ b/core/modules/migrate_drupal_ui/migrate_drupal_ui.install @@ -2,7 +2,7 @@ /** * @file - * Install, update and uninstall functions for the migrate_drupal_ui module. + * Install, update, and uninstall functions for the migrate_drupal_ui module. */ use Drupal\Core\Url; diff --git a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php index 7fa98ba..36e1e50 100644 --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -708,8 +708,8 @@ public function buildOverviewForm(array $form, FormStateInterface $form_state) { if ($date_performed = $this->state->get('migrate_drupal_ui.performed')) { $form['upgrade_option_item'] = [ '#type' => 'item', - '#prefix' => $this->t('

An upgrade has already been performed on this site.

'), - '#description' => $this->t('

Last upgrade: @date

', ['@date' => $this->dateFormatter->format($date_performed)]), + '#prefix' => '

' . $this->t('An upgrade has already been performed on this site.') . '

', + '#description' => '

' . $this->t('Last upgrade: @date', ['@date' => $this->dateFormatter->format($date_performed)]) . '

', ]; $form['upgrade_option'] = array( '#type' => 'radios', @@ -901,7 +901,7 @@ public function validateCredentialForm(array &$form, FormStateInterface $form_st } // Retrieve the database driver from the form, use reflection to get the - // namespace and then construct a valid database array the same as in + // namespace, and then construct a valid database array the same as in // settings.php. if ($driver = $form_state->getValue('driver')) { $drivers = $this->getDatabaseTypes(); @@ -923,7 +923,10 @@ public function validateCredentialForm(array &$form, FormStateInterface $form_st } else { $database = []; - // Find a migration which has database credentials and use those. + // Migration templates that had matching tags for the source Drupal + // version where converted to migration entities. Find one of those + // migrations to be able to look up the matching database credentials + // from state. $query = $this->entityStorage->getQuery('OR'); $ids = $query->execute(); foreach ($ids as $id) { @@ -1019,7 +1022,7 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { if ($rollback = $form_state->getValue('upgrade_option') == static::MIGRATE_UPGRADE_ROLLBACK) { $form_state->setStorage(['upgrade_option' => static::MIGRATE_UPGRADE_ROLLBACK]); $form['rollback'] = [ - '#markup' => $this->t('All previously-imported content, as well as configuration such as field definitions, will be removed.'), + '#markup' => $this->t('All previously imported content, as well as configuration such as field definitions, will be removed.'), ]; $form['actions']['submit']['#value'] = $this->t('Perform rollback'); } @@ -1039,6 +1042,8 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { $destination_module = $this->moduleUpgradePaths[$template_id]['destination_module']; $table_data[$source_module][$destination_module][$migration_id] = $migration['label']; } + // Sort the table by source module names and within that destination + // module names. ksort($table_data); foreach ($table_data as $source_module => $destination_module_info) { ksort($table_data[$source_module]); @@ -1049,7 +1054,7 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { $form['missing_module_list_title'] = [ '#type' => 'item', '#title' => $this->t('Missing upgrade paths'), - '#description' => $this->t('The following items will not be upgraded. For more information see Upgrading from Drupal 6 or 7 to Drupal 8.'), + '#description' => $this->t('The following items will not be upgraded. For more information see Upgrading from Drupal 6 or 7 to Drupal 8.', array(':migrate' => 'https://www.drupal.org/upgrade/migrate')), ]; $form['missing_module_list'] = [ '#type' => 'table', @@ -1214,7 +1219,7 @@ public function getCancelUrl() { * {@inheritdoc} */ public function getDescription() { - return $this->t('

Upgrade analysis report

'); + return '

' . $this->t('Upgrade analysis report') . '

'; } /** diff --git a/core/modules/migrate_drupal_ui/src/MigrateUpgradeRunBatch.php b/core/modules/migrate_drupal_ui/src/MigrateUpgradeRunBatch.php index 69c0bf6..669ec5e 100644 --- a/core/modules/migrate_drupal_ui/src/MigrateUpgradeRunBatch.php +++ b/core/modules/migrate_drupal_ui/src/MigrateUpgradeRunBatch.php @@ -46,6 +46,8 @@ class MigrateUpgradeRunBatch { /** * The maximum length in seconds to allow processing in a request. * + * @see self::run() + * * @var int */ protected static $maxExecTime; @@ -264,7 +266,7 @@ protected static function displayResults($results) { $successes = $results['successes']; $failures = $results['failures']; - // If we had any successes lot that for the user. + // 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')); diff --git a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php index ca8d213..a4911aa 100644 --- a/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php +++ b/core/modules/migrate_drupal_ui/src/Tests/MigrateUpgradeTestBase.php @@ -43,7 +43,7 @@ protected function setUp() { $this->sourceDatabase = Database::getConnection('default', 'migrate_drupal_ui'); // Create and log in as user 1. Migrations in the UI can only be performed - // as user 1. + // as user 1 once https://www.drupal.org/node/2675066 lands. $this->drupalLogin($this->rootUser); }