Skip to content
Permalink
Browse files

MDL-51080 env: warn when running MariaDB w/ wrong dbtype

  • Loading branch information...
scara committed Jun 7, 2018
1 parent 9e7c397 commit 09ca9728773bf039bf40e9353d17a01727eb5a5b
Showing with 14 additions and 0 deletions.
  1. +1 −0 lang/en/admin.php
  2. +13 −0 lib/environmentlib.php
@@ -529,6 +529,7 @@
$string['environmentsettingok'] = 'recommended setting detected';
$string['environmentshouldfixsetting'] = 'PHP setting should be changed.';
$string['environmentxmlerror'] = 'Error reading environment data ({$a->error_code})';
$string['environmentmariadbwrongdbtype'] = 'Wrong <code>$CFG->dbtype</code>: you need to change it in your <code>config.php</code> file, from \'<code>mysql</code>\' to \'<code>mariadb</code>\'.';
$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.';
@@ -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);

0 comments on commit 09ca972

Please sign in to comment.
You can’t perform that action at this time.