You are here

public function DrupalSqlBase::checkRequirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 RequirementsInterface::checkRequirements

File

core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php, line 101
Contains \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase.

Class

DrupalSqlBase
A base source class for Drupal migrate sources.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source

Code

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']) {
          throw new RequirementsException('Required minimum schema version ' . $this->pluginDefinition['minimum_schema_version'], [
            'minimum_schema_version' => $this->pluginDefinition['minimum_schema_version'],
          ]);
        }
      }
      else {
        throw new RequirementsException('Missing source provider ' . $this->pluginDefinition['source_provider'], [
          'source_provider' => $this->pluginDefinition['source_provider'],
        ]);
      }
    }
  }
}