From 475e9de86f5f4dc2bd37618a4876403561cbdd34 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 29 Mar 2006 23:38:46 +0000 Subject: [PATCH] SITE and SITEID were calculated *before* 'set names' so they weren't 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 | 14 -------------- lib/setup.php | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/lib/datalib.php b/lib/datalib.php index 2985bd11e6..fe4dfffa18 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -15,20 +15,6 @@ /// 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 //////////////////////////////// diff --git a/lib/setup.php b/lib/setup.php index 218b11fe67..1cc2146cc2 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -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'; -- 2.39.5