You are here

public function DrupalSqlBase::checkRequirements in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements()
  2. 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()
CommentType::checkRequirements in core/modules/comment/src/Plugin/migrate/source/CommentType.php
Checks if requirements for this plugin are OK.
ProfileField::checkRequirements in core/modules/user/src/Plugin/migrate/source/ProfileField.php
Checks if requirements for this plugin are OK.
4 methods override DrupalSqlBase::checkRequirements()
CommentEntityTranslation::checkRequirements in core/modules/comment/src/Plugin/migrate/source/d7/CommentEntityTranslation.php
Checks if requirements for this plugin are OK.
CommentType::checkRequirements in core/modules/comment/src/Plugin/migrate/source/CommentType.php
Checks if requirements for this plugin are OK.
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 104

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_version'])) {
          $minimum_version = $this->pluginDefinition['minimum_version'];
          $installed_version = $this
            ->getModuleSchemaVersion($this->pluginDefinition['source_module']);
          if ($minimum_version > $installed_version) {
            throw new RequirementsException('Required minimum version ' . $this->pluginDefinition['minimum_version'], [
              'minimum_version' => $this->pluginDefinition['minimum_version'],
            ]);
          }
        }
      }
      else {
        throw new RequirementsException('The module ' . $this->pluginDefinition['source_module'] . ' is not enabled in the source site.', [
          'source_module' => $this->pluginDefinition['source_module'],
        ]);
      }
    }
  }
}