function DrupalSqlBase::checkRequirements

Same name in other branches
  1. 9 core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements()
  2. 8.9.x core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements()
  3. 10 core/modules/migrate_drupal/src/Plugin/migrate/source/DrupalSqlBase.php \Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase::checkRequirements()

Overrides SqlBase::checkRequirements

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 ($source_module = $this->getSourceModule()) {
            if ($this->moduleExists($source_module)) {
                if (isset($this->pluginDefinition['minimum_version'])) {
                    $minimum_version = (int) $this->pluginDefinition['minimum_version'];
                    $installed_version = (int) $this->getModuleSchemaVersion($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 ' . $source_module . ' is not enabled in the source site.', [
                    'source_module' => $source_module,
                ]);
            }
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.