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 {
}
/**
- * 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.
*/
public function 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']]);
}
}
}
}
/**
- * 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.
}
/**
- * 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.
}
/**
- * Read a variable from a Drupal database.
+ * Reads a variable from a source Drupal database.
*
* @param $name
* Name of the variable.