From: toyomoyo Date: Thu, 9 Nov 2006 04:27:44 +0000 (+0000) Subject: adding more checks to make sure 1.8 is unicode only MDL-6332 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7ddf8aa59f3337bbf1a3cd3a8b93c563dc92ebf4;p=moodle.git adding more checks to make sure 1.8 is unicode only MDL-6332 --- diff --git a/lib/setup.php b/lib/setup.php index 4ae544fba4..d30a2584dd 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -213,6 +213,7 @@ global $HTTPSPAGEREQUIRED; set_config('unicodedb', $CFG->unicodedb); } } + /// Set the client/server and connection to utf8 if necessary /// and configure some other specific variables for each db configure_dbconnection(); @@ -637,4 +638,9 @@ $CFG->os = PHP_OS; } } +/// Moodle 1.8 needs to be run on unicode, kill if not unicodedb + if (!$CFG->unicodedb) { + print_error('unicoderequired', 'admin'); + } + ?> diff --git a/lib/setuplib.php b/lib/setuplib.php index a92fe4ff9e..13cd7f5078 100644 --- a/lib/setuplib.php +++ b/lib/setuplib.php @@ -91,13 +91,20 @@ function make_upload_directory($directory, $shownotices=true) { */ function setup_is_unicodedb() { - global $CFG, $db; + global $CFG, $db, $INSTALL; $unicodedb = false; + + // Since this function is also used during installation process, i.e. during install.php before $CFG->dbtype is set. + // we need to get dbtype from the right variable + if (!empty($INSTALL['dbtype'])) { + $dbtype = $INSTALL['dbtype']; + } else { + $dbtype = $CFG->dbtype; + } - switch ($CFG->dbtype) { + switch ($dbtype) { case 'mysql': - /// Get MySQL character_set_database value $rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'"); if ($rs && $rs->RecordCount() > 0) { $records = $rs->GetAssoc(true);