Commit d214deb3 authored by catch's avatar catch
Browse files

Issue #3203193 by murilohp, ankithashetty, Gábor Hojtsy, daffie, catch: Fail...

Issue #3203193 by murilohp, ankithashetty, Gábor Hojtsy, daffie, catch: Fail install if JSON is not supported by the database in Drupal 10
parent 2add9d83
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ abstract class Tasks {
        'Failed to <strong>DROP</strong> a test table from your database server. We tried dropping a table with the command %query and the server reported the following error %error.',
      ],
    ],
    [
      'function'    => 'checkJsonSupport',
      'arguments'   => [],
    ],
  ];

  /**
@@ -386,4 +390,16 @@ protected function getConnection() {
    return Database::getConnection();
  }

  /**
   * Checks the database json support.
   */
  protected function checkJsonSupport() {
    if ($this->getConnection()->hasJson()) {
      $this->pass(t('Database connection supports the JSON type.'));
    }
    else {
      $this->fail(t('<a href="https://www.drupal.org/docs/system-requirements">Database connection does not support JSON.</a>'));
    }
  }

}
+3 −4
Original line number Diff line number Diff line
@@ -566,9 +566,8 @@ function system_requirements($phase) {
    }
  }

  if ($phase == 'runtime') {
    // Test JSON support. To be required from Drupal 10.0.
    // @todo remove in https://www.drupal.org/project/drupal/issues/3203193
  if ($phase === 'runtime' || $phase === 'update') {
    // Test database JSON support.
    $requirements['database_support_json'] = [
      'title' => t('Database support for JSON'),
      'severity' => REQUIREMENT_OK,
@@ -578,7 +577,7 @@ function system_requirements($phase) {

    if (!Database::getConnection()->hasJson()) {
      $requirements['database_support_json']['value'] = t('Not available');
      $requirements['database_support_json']['severity'] = REQUIREMENT_WARNING;
      $requirements['database_support_json']['severity'] = REQUIREMENT_ERROR;
    }
  }