You are here

public function DrupalSqlBase::checkRequirements in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements()

Checks if requirements for this plugin are OK.

Throws

\Drupal\migrate\Exception\RequirementsException Thrown when requirements are not met.

Overrides SqlBase::checkRequirements

2 calls to DrupalSqlBase::checkRequirements()
ProfileField::checkRequirements in core/modules/user/src/Plugin/migrate/source/ProfileField.php
Checks if requirements for this plugin are OK.
VariableTranslation::checkRequirements in core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php
Checks if requirements for this plugin are OK.
2 methods override DrupalSqlBase::checkRequirements()
ProfileField::checkRequirements in core/modules/user/src/Plugin/migrate/source/ProfileField.php
Checks if requirements for this plugin are OK.
VariableTranslation::checkRequirements in core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php
Checks if requirements for this plugin are OK.

File

core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php, line 111

Class

DrupalSqlBase
A base class for source plugins using a Drupal database as a source.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source

Code

public function checkRequirements() {
  parent::checkRequirements();
  if ($this->pluginDefinition['requirements_met'] === TRUE) {
    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_module'] . ' is not enabled in the source site.', [
          'source_module' => $this->pluginDefinition['source_module'],
        ]);
      }
    }
  }
}