function Tasks::checkEngineVersion

Same name in other branches
  1. 9 core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php \Drupal\mysql\Driver\Database\mysql\Install\Tasks::checkEngineVersion()
  2. 9 core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::checkEngineVersion()
  3. 8.9.x core/lib/Drupal/Core/Database/Driver/mysql/Install/Tasks.php \Drupal\Core\Database\Driver\mysql\Install\Tasks::checkEngineVersion()
  4. 8.9.x core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::checkEngineVersion()
  5. 11.x core/lib/Drupal/Core/Database/Install/Tasks.php \Drupal\Core\Database\Install\Tasks::checkEngineVersion()

Checks the engine version.

1 call to Tasks::checkEngineVersion()
Tasks::engineVersionRequirementsCheck in core/lib/Drupal/Core/Database/Install/Tasks.php
Checks engine version requirements for the status report.

File

core/lib/Drupal/Core/Database/Install/Tasks.php, line 220

Class

Tasks
Database installer structure.

Namespace

Drupal\Core\Database\Install

Code

protected function checkEngineVersion() {
    // Ensure that the database server has the right version.
    // We append '-AnyName' to the minimum version for comparison purposes, so
    // that engines that append a package name or other build information to
    // their version strings still pass. For example, MariaDB might report its
    // version as '10.2.7-MariaDB' or '10.2.7+maria' or similar.
    // version_compare() treats '-' and '+' as equivalent, and non-numeric
    // parts other than conventional stability specifiers (dev, alpha, beta,
    // etc.) as equal to each other and less than numeric parts and stability
    // specifiers. In other words, 10.2.7-MariaDB, 10.2.7+maria, and
    // 10.2.7-AnyName are all equal to each other and less than 10.2.7-alpha.
    // This means that by appending '-AnyName' for the comparison check, that
    // alpha and other pre-release versions of the minimum will pass this
    // check, which isn't ideal; however, people running pre-release versions
    // of database servers should know what they're doing, whether Drupal warns
    // them or not.
    // @see https://www.php.net/manual/en/function.version-compare.php
    if ($this->minimumVersion() && version_compare(Database::getConnection()->version(), $this->minimumVersion() . '-AnyName', '<')) {
        $this->fail(t("The database server version %version is less than the minimum required version %minimum_version.", [
            '%version' => Database::getConnection()->version(),
            '%minimum_version' => $this->minimumVersion(),
        ]));
    }
}

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