function Tasks::checkEngineVersion

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

Overrides Tasks::checkEngineVersion

File

core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php, line 194

Class

Tasks
Specifies installation tasks for MySQL and equivalent databases.

Namespace

Drupal\mysql\Driver\Database\mysql\Install

Code

protected function checkEngineVersion() {
    parent::checkEngineVersion();
    // Ensure that the MySQL driver supports utf8mb4 encoding.
    $version = Database::getConnection()->clientVersion();
    if (FALSE !== strpos($version, 'mysqlnd')) {
        // The mysqlnd driver supports utf8mb4 starting at version 5.0.9.
        $version = preg_replace('/^\\D+([\\d.]+).*/', '$1', $version);
        if (version_compare($version, self::MYSQLND_MINIMUM_VERSION, '<')) {
            $this->fail(t("The MySQLnd driver version %version is less than the minimum required version. Upgrade to MySQLnd version %mysqlnd_minimum_version or up, or alternatively switch mysql drivers to libmysqlclient version %libmysqlclient_minimum_version or up.", [
                '%version' => $version,
                '%mysqlnd_minimum_version' => self::MYSQLND_MINIMUM_VERSION,
                '%libmysqlclient_minimum_version' => self::LIBMYSQLCLIENT_MINIMUM_VERSION,
            ]));
        }
    }
    else {
        // The libmysqlclient driver supports utf8mb4 starting at version 5.5.3.
        if (version_compare($version, self::LIBMYSQLCLIENT_MINIMUM_VERSION, '<')) {
            $this->fail(t("The libmysqlclient driver version %version is less than the minimum required version. Upgrade to libmysqlclient version %libmysqlclient_minimum_version or up, or alternatively switch mysql drivers to MySQLnd version %mysqlnd_minimum_version or up.", [
                '%version' => $version,
                '%libmysqlclient_minimum_version' => self::LIBMYSQLCLIENT_MINIMUM_VERSION,
                '%mysqlnd_minimum_version' => self::MYSQLND_MINIMUM_VERSION,
            ]));
        }
    }
}

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