]> git.mjollnir.org Git - moodle.git/commitdiff
SITE and SITEID were calculated *before* 'set names' so they weren't
authorstronk7 <stronk7>
Wed, 29 Mar 2006 23:38:46 +0000 (23:38 +0000)
committerstronk7 <stronk7>
Wed, 29 Mar 2006 23:38:46 +0000 (23:38 +0000)
fetched properly from DB. Moving such block of code from datalib.php
to setup.php to execute it *after* 'set names'. Credit goes to Skodak B-)

lib/datalib.php
lib/setup.php

index 2985bd11e6cde4c955a17b524cdcb4962cc8a575..fe4dfffa183a62b0f02c4b13b696754f313c1a85 100644 (file)
 
 /// GLOBAL CONSTANTS /////////////////////////////////////////////////////////
 
-if ($SITE = get_site()) {
-    /**
-     * If $SITE global from {@link get_site()} is set then SITEID to $SITE->id, otherwise set to 1.
-     */
-    define('SITEID', $SITE->id);
-} else {
-    /**
-     * @ignore
-     */
-    define('SITEID', 1);
-    define('COURSEID', 1);
-}
-
-$COURSE->id = SITEID;   // For now.  This will usually get reset later in require_login() etc.
 
 /// FUNCTIONS FOR DATABASE HANDLING  ////////////////////////////////
 
index 218b11fe67c4473b6b7ace02180e3ae6daa520cf..1cc2146cc2a9e654c077c02cf32607bb3ebcc898 100644 (file)
@@ -216,6 +216,23 @@ global $HTTPSPAGEREQUIRED;
 /// work with the DB, but never before this!
 
 
+//// Defining the site
+    if ($SITE = get_site()) {
+        /**
+         * If $SITE global from {@link get_site()} is set then SITEID to $SITE->id, otherwise set to 1.
+         */
+        define('SITEID', $SITE->id);
+    } else {
+        /**
+         * @ignore
+         */
+        define('SITEID', 1);
+        define('COURSEID', 1);
+    }
+/// And the 'default' course
+    $COURSE->id = SITEID;   // For now.  This will usually get reset later in require_login() etc.
+
+
 /// Set a default enrolment configuration (see bug 1598)
     if (!isset($CFG->enrol)) {
         $CFG->enrol = 'manual';