Issue #3203193 by murilohp, ankithashetty, Gábor Hojtsy, daffie, catch: Fail install if JSON is not supported by the database in Drupal 10

merge-requests/1757/merge
catch 2022-02-18 08:18:03 +00:00
parent 2add9d83da
commit d214deb310
2 changed files with 19 additions and 4 deletions

View File

@ -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 @@ abstract class Tasks {
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>'));
}
}
}

View File

@ -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;
}
}