From c8e201a167d04ed7f3e514738e107235a8b9133a Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Sat, 4 May 2024 12:48:13 +0100
Subject: [PATCH] =?UTF-8?q?Issue=20#3421175=20by=20quietone,=20catch,=20G?=
 =?UTF-8?q?=C3=A1bor=20Hojtsy,=20alexpott,=20smustgrave,=20longwave,=20daf?=
 =?UTF-8?q?fie:=20Update=20INSTALL.txt=20and=20hook=5Frequirements()=20etc?=
 =?UTF-8?q?.=20with=20remaining=20Drupal=2011=20platform=20requirements?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitlab-ci.yml                                | 35 ++-----------------
 core/INSTALL.txt                              | 10 +++---
 .../scaffold/files/default.settings.php       |  2 +-
 .../src/Plugin/migrate/source/SqlBase.php     |  2 +-
 core/modules/mysql/mysql.install              |  9 +----
 .../src/Driver/Database/mysql/Connection.php  |  9 ++---
 .../Driver/Database/mysql/Install/Tasks.php   | 10 ++----
 ...llerIsolationLevelExistingSettingsTest.php |  8 +----
 ...erIsolationLevelNoDatabaseSettingsTest.php |  8 +----
 .../Driver/Database/pgsql/Install/Tasks.php   |  4 +--
 sites/default/default.settings.php            |  2 +-
 11 files changed, 21 insertions(+), 78 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0ca45f04e923..8deb439d4bf9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -193,36 +193,12 @@ default:
 # Main listing of jobs.
 # All of these are available on Merge Requests and also work as base jobs for
 # on-commit and daily jobs to extend from.
-'PHP 8.3 MySQL 5.7':
-  <<: [ *default-stage, *run-on-mr ]
-  variables:
-    _TARGET_PHP: "8.3"
-    _TARGET_DB: "mysql-5.7"
-
-'PHP 8.3 MariaDB 10.3.22':
-  <<: [ *default-stage, *run-on-mr ]
-  variables:
-    _TARGET_PHP: "8.3"
-    _TARGET_DB: "mariadb-10.3.22"
-
 'PHP 8.3 MariaDB 10.6':
   <<: [ *default-stage, *run-on-mr ]
   variables:
     _TARGET_PHP: "8.3"
     _TARGET_DB: "mariadb-10.6"
 
-'PHP 8.3 PostgreSQL 14.1':
-  <<: [ *default-stage, *run-on-mr ]
-  variables:
-    _TARGET_PHP: "8.3"
-    _TARGET_DB: "pgsql-14.1"
-
-'PHP 8.3 PostgreSQL 15':
-  <<: [ *default-stage, *run-on-mr ]
-  variables:
-    _TARGET_PHP: "8.3"
-    _TARGET_DB: "pgsql-15"
-
 'PHP 8.3 PostgreSQL 16':
   <<: [ *default-stage, *run-on-mr ]
   variables:
@@ -237,14 +213,9 @@ default:
 
 # Jobs running on commits.
 # The value set in the "needs" property will determine the order in the sequence.
-'[Commit] PHP 8.3 MySQL 5.7':
-  extends: 'PHP 8.3 MySQL 5.7'
-  needs: [ 'DEFAULT: PHP 8.3 MySQL 8' ]
-  <<: [ *run-on-commit ]
-
 '[Commit] PHP 8.3 PostgreSQL 16':
   extends: 'PHP 8.3 PostgreSQL 16'
-  needs: [ '[Commit] PHP 8.3 MySQL 5.7' ]
+  needs: [ 'DEFAULT: PHP 8.3 MySQL 8' ]
   <<: [ *run-on-commit ]
 
 '[Commit] PHP 8.3 SQLite 3.45':
@@ -264,8 +235,8 @@ default:
   needs: [ '[Daily] PHP 8.3 PostgreSQL 16' ]
   <<: [ *run-daily ]
 
-'[Daily] PHP 8.3 MariaDB 10.3.22':
-  extends: 'PHP 8.3 MariaDB 10.3.22'
+'[Daily] PHP 8.3 MariaDB 10.6':
+  extends: 'PHP 8.3 MariaDB 10.6'
   needs: [ '[Daily] PHP 8.3 SQLite 3.45' ]
   <<: [ *run-daily ]
 
diff --git a/core/INSTALL.txt b/core/INSTALL.txt
index a484cc10793d..2aec43b2c9f4 100644
--- a/core/INSTALL.txt
+++ b/core/INSTALL.txt
@@ -50,13 +50,13 @@ Drupal requires:
   - Nginx 1.1 (or greater) (http://nginx.com/).
 - PHP 8.3.0 (or greater) (http://php.net/).
 - One of the following databases:
-  - MySQL 5.7.8 (or greater) (http://www.mysql.com/).
-  - MariaDB 10.3.7 (or greater) (https://mariadb.org/). MariaDB is a fully
+  - MySQL 8.0.0 (or greater) (http://www.mysql.com/).
+  - MariaDB 10.6.0 (or greater) (https://mariadb.org/). MariaDB is a fully
     compatible drop-in replacement for MySQL.
-  - Percona Server 5.7.8 (or greater) (http://www.percona.com/). Percona
+  - Percona Server 8.0.0 (or greater) (http://www.percona.com/). Percona
     Server is a backwards-compatible replacement for MySQL.
-  - PostgreSQL 10 (or greater) (http://www.postgresql.org/).
-  - SQLite 3.26 (or greater) (http://www.sqlite.org/).
+  - PostgreSQL 16 (or greater) (http://www.postgresql.org/).
+  - SQLite 3.45 (or greater) (http://www.sqlite.org/).
 
 For more detailed information about Drupal requirements, including a list of
 PHP extensions and configurations that are required, see "System requirements"
diff --git a/core/assets/scaffold/files/default.settings.php b/core/assets/scaffold/files/default.settings.php
index 960322d2dc18..cd364bb00df0 100644
--- a/core/assets/scaffold/files/default.settings.php
+++ b/core/assets/scaffold/files/default.settings.php
@@ -144,7 +144,7 @@
  * in deadlocks, the other two options are 'READ UNCOMMITTED' and 'SERIALIZABLE'.
  * They are available but not supported; use them at your own risk. For more
  * info:
- * https://dev.mysql.com/doc/refman/5.7/en/innodb-transaction-isolation-levels.html
+ * https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html
  *
  * On your settings.php, change the isolation level:
  * @code
diff --git a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
index 022a94e37445..867943abc6a5 100644
--- a/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
+++ b/core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
@@ -333,7 +333,7 @@ protected function initializeIterator() {
       }
       // If the query has a group by, our added fields need it too, to keep the
       // query valid.
-      // @see https://dev.mysql.com/doc/refman/5.7/en/group-by-handling.html
+      // @see https://dev.mysql.com/doc/refman/8.0/en/group-by-handling.html
       $group_by = $this->query->getGroupBy();
       if ($group_by && $added_fields) {
         foreach ($added_fields as $added_field) {
diff --git a/core/modules/mysql/mysql.install b/core/modules/mysql/mysql.install
index e4ddf8d10b68..6523af0e9dff 100644
--- a/core/modules/mysql/mysql.install
+++ b/core/modules/mysql/mysql.install
@@ -23,14 +23,7 @@ function mysql_requirements($phase) {
         return [];
       }
 
-      $query = 'SELECT @@SESSION.tx_isolation';
-      // The database variable "tx_isolation" has been removed in MySQL v8.0.3 and
-      // has been replaced by "transaction_isolation".
-      // @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tx_isolation
-      // @see https://dev.mysql.com/doc/refman/8.0/en/added-deprecated-removed.html
-      if (!$connection->isMariaDb() && version_compare($connection->version(), '8.0.2-AnyName', '>')) {
-        $query = 'SELECT @@SESSION.transaction_isolation';
-      }
+      $query = $connection->isMariaDb() ? 'SELECT @@SESSION.tx_isolation' : 'SELECT @@SESSION.transaction_isolation';
 
       $isolation_level = $connection->query($query)->fetchField();
 
diff --git a/core/modules/mysql/src/Driver/Database/mysql/Connection.php b/core/modules/mysql/src/Driver/Database/mysql/Connection.php
index 3a28b9f4167e..09f3d4980b9c 100644
--- a/core/modules/mysql/src/Driver/Database/mysql/Connection.php
+++ b/core/modules/mysql/src/Driver/Database/mysql/Connection.php
@@ -54,7 +54,7 @@ class Connection extends DatabaseConnection implements SupportsTemporaryTablesIn
    * The minimal possible value for the max_allowed_packet setting of MySQL.
    *
    * @link https://mariadb.com/kb/en/mariadb/server-system-variables/#max_allowed_packet
-   * @link https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_allowed_packet
+   * @link https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_max_allowed_packet
    *
    * @var int
    */
@@ -73,11 +73,8 @@ public function __construct(\PDO $connection, array $connection_options) {
     // combination mode), then MySQL doesn't interpret a double quote as an
     // identifier quote, in which case use the non-ANSI-standard backtick.
     //
-    // Because we still support MySQL 5.7, check for the deprecated combination
-    // modes as well.
-    //
-    // @see https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_ansi_quotes
-    $ansi_quotes_modes = ['ANSI_QUOTES', 'ANSI', 'DB2', 'MAXDB', 'MSSQL', 'ORACLE', 'POSTGRESQL'];
+    // @see https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html#sqlmode_ansi_quotes
+    $ansi_quotes_modes = ['ANSI_QUOTES', 'ANSI'];
     $is_ansi_quotes_mode = FALSE;
     if (isset($connection_options['init_commands']['sql_mode'])) {
       foreach ($ansi_quotes_modes as $mode) {
diff --git a/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php b/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
index 4dbd2addf399..b7b7a14908c9 100644
--- a/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
+++ b/core/modules/mysql/src/Driver/Database/mysql/Install/Tasks.php
@@ -15,19 +15,13 @@ class Tasks extends InstallTasks {
 
   /**
    * Minimum required MySQL version.
-   *
-   * 5.7.8 is the minimum version that supports the JSON datatype.
-   * @see https://dev.mysql.com/doc/refman/5.7/en/json.html
    */
-  const MYSQL_MINIMUM_VERSION = '5.7.8';
+  const MYSQL_MINIMUM_VERSION = '8.0';
 
   /**
    * Minimum required MariaDB version.
-   *
-   * 10.3.7 is the first stable (GA) release in the 10.3 series.
-   * @see https://mariadb.com/kb/en/changes-improvements-in-mariadb-103/#list-of-all-mariadb-103-releases
    */
-  const MARIADB_MINIMUM_VERSION = '10.3.7';
+  const MARIADB_MINIMUM_VERSION = '10.6';
 
   /**
    * The PDO driver name for MySQL and equivalent databases.
diff --git a/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelExistingSettingsTest.php b/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelExistingSettingsTest.php
index 598449dc3e04..4eae070981e7 100644
--- a/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelExistingSettingsTest.php
+++ b/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelExistingSettingsTest.php
@@ -52,13 +52,7 @@ public function testInstaller() {
     Database::closeConnection('default', 'default');
     $connection = Database::getConnection('default', 'default');
 
-    $query = 'SELECT @@SESSION.tx_isolation';
-    // The database variable "tx_isolation" has been removed in MySQL v8.0 and
-    // has been replaced by "transaction_isolation".
-    // @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tx_isolation
-    if (!$connection->isMariaDb() && version_compare($connection->version(), '8.0.0-AnyName', '>')) {
-      $query = 'SELECT @@SESSION.transaction_isolation';
-    }
+    $query = $connection->isMariaDb() ? 'SELECT @@SESSION.tx_isolation' : 'SELECT @@SESSION.transaction_isolation';
 
     // Test that transaction level is REPEATABLE READ.
     $this->assertEquals('REPEATABLE-READ', $connection->query($query)->fetchField());
diff --git a/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelNoDatabaseSettingsTest.php b/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelNoDatabaseSettingsTest.php
index 712cac68e7bd..28809d55b1ef 100644
--- a/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelNoDatabaseSettingsTest.php
+++ b/core/modules/mysql/tests/src/Functional/InstallerIsolationLevelNoDatabaseSettingsTest.php
@@ -56,13 +56,7 @@ public function testInstaller() {
     Database::closeConnection('default', 'default');
     $connection = Database::getConnection('default', 'default');
 
-    $query = 'SELECT @@SESSION.tx_isolation';
-    // The database variable "tx_isolation" has been removed in MySQL v8.0 and
-    // has been replaced by "transaction_isolation".
-    // @see https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_tx_isolation
-    if (!$connection->isMariaDb() && version_compare($connection->version(), '8.0.0-AnyName', '>')) {
-      $query = 'SELECT @@SESSION.transaction_isolation';
-    }
+    $query = $connection->isMariaDb() ? 'SELECT @@SESSION.tx_isolation' : 'SELECT @@SESSION.transaction_isolation';
 
     // Test that transaction level is READ-COMMITTED.
     $this->assertEquals('READ-COMMITTED', $connection->query($query)->fetchField());
diff --git a/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php b/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
index 0922e47302f0..eb3a5d73b6d4 100644
--- a/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
+++ b/core/modules/pgsql/src/Driver/Database/pgsql/Install/Tasks.php
@@ -18,9 +18,9 @@ class Tasks extends InstallTasks {
    *
    * The contrib extension pg_trgm is supposed to be installed.
    *
-   * @see https://www.postgresql.org/docs/12/pgtrgm.html
+   * @see https://www.postgresql.org/docs/16/pgtrgm.html
    */
-  const PGSQL_MINIMUM_VERSION = '12';
+  const PGSQL_MINIMUM_VERSION = '16';
 
   /**
    * {@inheritdoc}
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 960322d2dc18..cd364bb00df0 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -144,7 +144,7 @@
  * in deadlocks, the other two options are 'READ UNCOMMITTED' and 'SERIALIZABLE'.
  * They are available but not supported; use them at your own risk. For more
  * info:
- * https://dev.mysql.com/doc/refman/5.7/en/innodb-transaction-isolation-levels.html
+ * https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html
  *
  * On your settings.php, change the isolation level:
  * @code
-- 
GitLab