From: skodak <skodak>
Date: Wed, 30 Jul 2008 09:10:02 +0000 (+0000)
Subject: MDL-15883 initialise mnet from admin/index.php
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=7b3c273b1d1cb5124de30506278c0acee1dd282d;p=moodle.git

MDL-15883 initialise mnet from admin/index.php
---

diff --git a/admin/index.php b/admin/index.php
index 1cc36e72e8..13ab66473a 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -501,6 +501,12 @@
         set_config('siteidentifier', random_string(32).$_SERVER['HTTP_HOST']);
     }
 
+/// ugly hack - if mnet is not initialised include the mnet lib, it adds needed mnet records and configures config options  
+///             we should not do such crazy stuff in lib functions!!!
+    if (empty($CFG->mnet_localhost_id)) {
+        require_once $CFG->dirroot.'/mnet/lib.php';
+    }
+
 /// Check if the guest user exists.  If not, create one.
     if (!$DB->record_exists('user', array('username'=>'guest'))) {
         if (! $guest = create_guest_record()) {
@@ -508,7 +514,6 @@
         }
     }
 
-
 /// Set up the admin user
     if (empty($CFG->rolesactive)) {
         build_context_path(); // just in case - should not be needed