checkEngineVersion example



  /** * Checks engine version requirements for the status report. * * This method is called during runtime and update requirements checks. * * @return \Drupal\Core\StringTranslation\TranslatableMarkup[] * A list of error messages. */
  final public function engineVersionRequirementsCheck() {
    $this->checkEngineVersion();
    return $this->results['fail'];
  }

  /** * Checks if we can connect to the database. * * @return bool * TRUE if we can connect to the database, otherwise FALSE. */
  protected function connect() {
    try {
      
public function ensureInnoDbAvailable() {
    $engines = Database::getConnection()->query('SHOW ENGINES')->fetchAllKeyed();
    if (isset($engines['MyISAM']) && $engines['MyISAM'] == 'DEFAULT' && !isset($engines['InnoDB'])) {
      $this->fail(t('The MyISAM storage engine is not supported.'));
    }
  }

  /** * {@inheritdoc} */
  protected function checkEngineVersion() {
    parent::checkEngineVersion();

    // Ensure that the MySQL driver supports utf8mb4 encoding.     $version = Database::getConnection()->clientVersion();
    if (str_contains($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 {
      
Home | Imprint | This part of the site doesn't use cookies.