Commit 0b6eaa44 authored by Nigel McNie's avatar Nigel McNie
Browse files

Be more explicit about our checking for database types. This prevents random...

Be more explicit about our checking for database types. This prevents random fatal errors if the appropriate database extension isn't installed, because ADODB isn't smart enough to test for this itself.

Also deprecate the 'mysql' database type, in favour of 'mysql5'. This brings it into alignment with the 'postgres8' type. The 'mysql' type will issue a log_environ error in 1.0 and crash in 1.1.
parent 5c74951e
...@@ -42,8 +42,20 @@ function ensure_sanity() { ...@@ -42,8 +42,20 @@ function ensure_sanity() {
if (!extension_loaded('json')) { if (!extension_loaded('json')) {
throw new ConfigSanityException(get_string('jsonextensionnotloaded', 'error')); throw new ConfigSanityException(get_string('jsonextensionnotloaded', 'error'));
} }
if (!extension_loaded('pgsql') && !extension_loaded('mysqli')) { switch (get_config('dbtype')) {
throw new ConfigSanityException(get_string('dbextensionnotloaded', 'error')); case 'postgres8':
if (!extension_loaded('pgsql')) {
throw new ConfigSanityException(get_string('pgsqldbextensionnotloaded', 'error'));
case 'mysql5':
case 'mysql': // NOTE: mysql to be phased out. This should be log_environ() in 1.0 and removed in 1.1
if (!extension_loaded('mysql')) {
throw new ConfigSanityException(get_string('mysqldbextensionnotloaded', 'error'));
throw new ConfigSanityException(get_string('unknowndbtype', 'error'));
} }
if (!extension_loaded('libxml')) { if (!extension_loaded('libxml')) {
throw new ConfigSanityException(get_string('libxmlextensionnotloaded', 'error')); throw new ConfigSanityException(get_string('libxmlextensionnotloaded', 'error'));
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment