diff --git a/docs/content/users/topics/cms_specific_help.md b/docs/content/users/topics/cms_specific_help.md index 28a1d1da55d..f783edb5d82 100644 --- a/docs/content/users/topics/cms_specific_help.md +++ b/docs/content/users/topics/cms_specific_help.md @@ -25,6 +25,9 @@ This helps new users and people who are kicking the tires on a CMS. Plus it’s ### Drupal Specifics * **Settings Files**: By default, DDEV will create settings files for your project that make it “just work” out of the box. It creates a `sites/default/settings.ddev.php` and adds an include in `sites/default/settings.php` to bring that in. There are guards to prevent the `settings.ddev.php` from being active when the project is not running under DDEV, but it still should not be checked in and is gitignored. +* **Database requirements for Drupal 9.5+ +**: + * Using MySQL or MariaDB, Drupal requires `SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED` and DDEV does this for you on `ddev start`. + * Using PostgreSQL, Drupal requires the`pg_trm` extension. DDEV creates this extension automatically for you on `ddev start`. * **Twig Debugging**: With the default Drupal configuration, it’s very difficult to debug Twig templates; you need to use `development.services.yml` instead of `services.yml`. Add this line in your `settings.php` or `settings.local.php`. See discussion at [drupal.org](https://www.drupal.org/forum/support/module-development-and-code-questions/2019-09-02/ddev-twig-debugging) and the Drupal documentation. ```php diff --git a/pkg/ddevapp/drupal.go b/pkg/ddevapp/drupal.go index 60777225e86..9f03e688984 100755 --- a/pkg/ddevapp/drupal.go +++ b/pkg/ddevapp/drupal.go @@ -382,15 +382,28 @@ func drupal8PostStartAction(app *DdevApp) error { } func drupalPostStartAction(app *DdevApp) error { - // pg_trm extension is required - if app.Database.Type == nodeps.Postgres && (isDrupal9App(app) || isDrupal10App(app)) { - stdout, stderr, err := app.Exec(&ExecOpts{ - Service: "db", - Cmd: `psql -q -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" 2>/dev/null`, - NoCapture: false, - }) - if err != nil { - util.Warning("unable to CREATE EXTENSION pg_trm: stdout='%s', stderr='%s', err=%v", stdout, stderr, err) + if isDrupal9App(app) || isDrupal10App(app) { + // pg_trm extension is required in Drupal9.5+ + if app.Database.Type == nodeps.Postgres { + stdout, stderr, err := app.Exec(&ExecOpts{ + Service: "db", + Cmd: `psql -q -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" 2>/dev/null`, + NoCapture: false, + }) + if err != nil { + util.Warning("unable to CREATE EXTENSION pg_trm: stdout='%s', stderr='%s', err=%v", stdout, stderr, err) + } + } + // SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED required in Drupal 9.5+ + if app.Database.Type == nodeps.MariaDB || app.Database.Type == nodeps.MySQL { + stdout, stderr, err := app.Exec(&ExecOpts{ + Service: "db", + Cmd: `mysql -e "SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED;" 2>/dev/null`, + NoCapture: false, + }) + if err != nil { + util.Warning("unable to SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED: stdout='%s', stderr='%s', err=%v", stdout, stderr, err) + } } } // Return early because we aren't expected to manage settings. diff --git a/pkg/ddevapp/drupal/drupal10/settings.ddev.php b/pkg/ddevapp/drupal/drupal10/settings.ddev.php index 1deb96b8856..d547c72d688 100644 --- a/pkg/ddevapp/drupal/drupal10/settings.ddev.php +++ b/pkg/ddevapp/drupal/drupal10/settings.ddev.php @@ -28,13 +28,6 @@ 'prefix' => "{{ $config.DatabasePrefix }}", ); - -// Setting the MySQL transaction isolation level. -// @see https://www.drupal.org/docs/system-requirements/setting-the-mysql-transaction-isolation-level -if ($driver === "mysql") { - $databases['default']['default']['init_commands']['isolation_level'] = 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED'; -} - $settings['hash_salt'] = '{{ $config.HashSalt }}'; // This will prevent Drupal from setting read-only permissions on sites/default. diff --git a/pkg/ddevapp/drupal/drupal9/settings.ddev.php b/pkg/ddevapp/drupal/drupal9/settings.ddev.php index bf4d696ec19..ce7556a95e3 100644 --- a/pkg/ddevapp/drupal/drupal9/settings.ddev.php +++ b/pkg/ddevapp/drupal/drupal9/settings.ddev.php @@ -28,13 +28,6 @@ 'prefix' => "{{ $config.DatabasePrefix }}", ); - -// Setting the MySQL transaction isolation level. -// @see https://www.drupal.org/docs/system-requirements/setting-the-mysql-transaction-isolation-level -if ($driver === "mysql") { - $databases['default']['default']['init_commands']['isolation_level'] = 'SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED'; -} - $settings['hash_salt'] = '{{ $config.HashSalt }}'; // This will prevent Drupal from setting read-only permissions on sites/default.