X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fmigrate_drupal%2Fsrc%2FPlugin%2Fmigrate%2Fsource%2FDrupalSqlBase.php;h=15acb0213fb60130ed275cd451df9042314f9385;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=ffff6269cd6596032ccd48521a60ccfebd857253;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php b/web/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php index ffff6269c..15acb0213 100644 --- a/web/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php +++ b/web/core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php @@ -13,10 +13,19 @@ use Drupal\migrate\Plugin\migrate\source\SqlBase; use Symfony\Component\DependencyInjection\ContainerInterface; /** - * A base source class for Drupal migrate sources. + * A base class for source plugins using a Drupal database as a source. * - * Mainly to let children retrieve information from the origin system in an - * easier way. + * Provides general purpose helper methods that are commonly needed + * when writing source plugins that use a Drupal database as a source, for + * example: + * - Check if the given module exists in the source database. + * - Read Drupal configuration variables from the source database. + * + * For a full list, refer to the methods of this class. + * + * For available configuration keys, refer to the parent classes: + * @see \Drupal\migrate\Plugin\migrate\source\SqlBase + * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase */ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginInterface, DependentPluginInterface { @@ -52,7 +61,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn } /** - * Retrieves all system data information from origin system. + * Retrieves all system data information from the source Drupal database. * * @return array * List of system table information keyed by type and name. @@ -93,23 +102,23 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn * {@inheritdoc} */ public function checkRequirements() { + parent::checkRequirements(); if ($this->pluginDefinition['requirements_met'] === TRUE) { - if (isset($this->pluginDefinition['source_provider'])) { - if ($this->moduleExists($this->pluginDefinition['source_provider'])) { - if (isset($this->pluginDefinition['minimum_schema_version']) && !$this->getModuleSchemaVersion($this->pluginDefinition['source_provider']) < $this->pluginDefinition['minimum_schema_version']) { + if (isset($this->pluginDefinition['source_module'])) { + if ($this->moduleExists($this->pluginDefinition['source_module'])) { + if (isset($this->pluginDefinition['minimum_schema_version']) && !$this->getModuleSchemaVersion($this->pluginDefinition['source_module']) < $this->pluginDefinition['minimum_schema_version']) { throw new RequirementsException('Required minimum schema version ' . $this->pluginDefinition['minimum_schema_version'], ['minimum_schema_version' => $this->pluginDefinition['minimum_schema_version']]); } } else { - throw new RequirementsException('The module ' . $this->pluginDefinition['source_provider'] . ' is not enabled in the source site.', ['source_provider' => $this->pluginDefinition['source_provider']]); + throw new RequirementsException('The module ' . $this->pluginDefinition['source_module'] . ' is not enabled in the source site.', ['source_module' => $this->pluginDefinition['source_module']]); } } } - parent::checkRequirements(); } /** - * Get a module schema_version value in the source installation. + * Retrieves a module schema_version from the source Drupal database. * * @param string $module * Name of module. @@ -124,7 +133,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn } /** - * Check to see if a given module is enabled in the source installation. + * Checks if a given module is enabled in the source Drupal database. * * @param string $module * Name of module to check. @@ -138,7 +147,7 @@ abstract class DrupalSqlBase extends SqlBase implements ContainerFactoryPluginIn } /** - * Read a variable from a Drupal database. + * Reads a variable from a source Drupal database. * * @param $name * Name of the variable.