diff --git a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php index 38ce1137b93..633e7fe0b62 100644 --- a/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php +++ b/core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php @@ -4,6 +4,7 @@ namespace Drupal\migrate_drupal\Plugin\migrate\source\d6; use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\State\StateInterface; +use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; @@ -12,7 +13,7 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase; * * @MigrateSource( * id = "d6_variable_translation", - * source_module = "system", + * source_module = "i18n", * ) */ class VariableTranslation extends DrupalSqlBase { @@ -98,4 +99,14 @@ class VariableTranslation extends DrupalSqlBase { return $ids; } + /** + * {@inheritdoc} + */ + public function checkRequirements() { + if (!$this->getDatabase()->schema()->tableExists('i18n_variable')) { + throw new RequirementsException("Source database table 'i18n_variable' does not exist"); + } + parent::checkRequirements(); + } + } diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php new file mode 100644 index 00000000000..6001e4ed8c8 --- /dev/null +++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/VariableTranslationCheckRequirementsTest.php @@ -0,0 +1,38 @@ +sourceDatabase->schema()->dropTable('i18n_variable'); + } + + /** + * Tests exception in thrown when the i18n_variable table does not exist. + */ + public function testCheckRequirements() { + $this->expectException(RequirementsException::class); + $this->expectExceptionMessage("Source database table 'i18n_variable' does not exist"); + $this->getMigration('d6_system_maintenance_translation') + ->getSourcePlugin() + ->checkRequirements(); + } + +}