diff --git a/lang/en/admin.php b/lang/en/admin.php index aa79e8e6f78..3680d03ba5d 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -529,6 +529,7 @@ $string['environmentrequireversion'] = 'version {$a->needed} is required and you $string['environmentsettingok'] = 'recommended setting detected'; $string['environmentshouldfixsetting'] = 'PHP setting should be changed.'; $string['environmentxmlerror'] = 'Error reading environment data ({$a->error_code})'; +$string['environmentmariadbwrongdbtype'] = 'Wrong $CFG->dbtype: you need to change it in your config.php file, from \'mysql\' to \'mariadb\'.'; $string['errordeletingconfig'] = 'An error occurred while deleting the configuration records for plugin \'{$a}\'.'; $string['errorsetting'] = 'Could not save setting:'; $string['errorwithsettings'] = 'Some settings were not changed due to an error.'; diff --git a/lib/environmentlib.php b/lib/environmentlib.php index 270d79c54dc..51ea48db52e 100644 --- a/lib/environmentlib.php +++ b/lib/environmentlib.php @@ -1048,6 +1048,19 @@ function environment_check_database($version, $env_select) { return $result; } + // Check if the DB Vendor has been properly configured. + // Hack: this is required when playing with MySQL and MariaDB since they share the same PHP module and base DB classes, + // whilst they are slowly evolving using separate directions though MariaDB is still an "almost" drop-in replacement. + $dbvendorismysql = ($current_vendor === 'mysql'); + $dbtypeismariadb = (stripos($dbinfo['description'], 'mariadb') !== false); + if ($dbvendorismysql && $dbtypeismariadb) { + $result->setStatus(false); + $result->setLevel($level); + $result->setInfo($current_vendor . ' (' . $dbinfo['description'] . ')'); + $result->setFeedbackStr('environmentmariadbwrongdbtype'); + return $result; + } + /// And finally compare them, saving results if (version_compare($current_version, $needed_version, '>=')) { $result->setStatus(true);