Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ jobs:
php-version:
- "8.2"
test-args:
- "--group Database"
- "core/modules/file/tests/src/Functional/FileFieldWidgetTest.php"
# - "--group Database"
# - "--group Entity"
# - "--group Cache,Config"
- "--group field,Field"
- "--group file"
- "--group views"
# - "--group field,Field"
# - "--group file"
# - "--group views"

services:
mysql:
Expand Down
50 changes: 50 additions & 0 deletions drudbal.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

/**
* @file
* Install, update and uninstall functions for the drudbal module.
*/

use Drupal\Core\Database\Database;
use Drupal\Core\Render\Markup;

/**
* Implements hook_requirements().
*/
function drudbal_requirements($phase) {
$requirements = [];

if ($phase === 'runtime') {
// Test with MySql databases.
if (Database::isActiveConnection()) {
$connection = Database::getConnection();
// Only show requirements when MySQL is the default database connection.
if ($connection->driver() === 'dbal' && $connection->databaseType() === 'mysql') {
$query = 'SELECT @@SESSION.tx_isolation';
$isolation_level = $connection->query($query)->fetchField();
$description = [];
if ($isolation_level == 'READ-COMMITTED') {
$severity_level = REQUIREMENT_OK;
}
else {
if ($isolation_level == 'REPEATABLE-READ') {
$severity_level = REQUIREMENT_WARNING;
}
else {
$severity_level = REQUIREMENT_ERROR;
$description[] = t('This is not supported by Drupal.');
}
$description[] = t('The recommended level for Drupal is "READ COMMITTED".');
}
$requirements['mysql_transaction_level'] = [
'title' => t('Transaction isolation level'),
'severity' => $severity_level,
'value' => $isolation_level,
'description' => Markup::create(implode(' ', $description)),
];
}
}
}

return $requirements;
}
Loading