Problem/Motivation
In #3109534: Raise the minimum MySQL version to 5.7.8 and MariaDB version to 10.2.7 in Drupal 9, we raised the minimum MySQL version to 5.7 for Drupal 9.0. However, MySQL 5.6 isn't EOL until Feb. 2021. We should therefore make it possible for people to have a custom driver that allows MySQL 5.6, at least for a little while. At some point, possibly as early as Drupal 9.1, we might start using MySQL 5.7 features, such as JSON, that'll be hard for a 5.6 driver to implement. But even if a MySQL 5.6 custom driver is only functional for Drupal 9.0 (and not 9.1), Drupal 9.0 will be supported until after Feb. 2021, so even a trivial custom driver can get people past MySQL 5.6's EOL.
To a large extent, core already allows custom drivers to extend the core ones. Within settings.php
, you can have:
$databases['default']['default'] = array (
'namespace' => 'Drupal\\Driver\\Database\\mysql',
'driver' => 'mysql',
...
);
which works as expected.
However, there are two places where the above namespace from the above connection info array is not checked:
- In
db_installer_object()
, used by the installer before settings.php has been written. - In
Database::convertDbUrlToConnectionInfo()
, which can be called from places that only have a db URL and not a connection info array. In core, that's just tests and console commands.
In these two places, HEAD currently checks the core namespace first, and only checks the custom namespace for drivers that aren't in core. This would prevent, for example, a custom MySQL driver from being used during installation and tests.
Proposed resolution
Change the above two places to check for a driver in the custom namespace first, and then fall back to the core namespace.