MDL-36779 fix undefined NO_MOODLE_COOKIE after failed db connect
authorPetr Škoda <commits@skodak.org>
Thu, 22 Nov 2012 09:31:58 +0000 (10:31 +0100)
committerAparup Banerjee <aparup@moodle.com>
Fri, 23 Nov 2012 04:05:49 +0000 (12:05 +0800)
lib/sessionlib.php

index aedd344..123c70e 100644 (file)
@@ -41,6 +41,12 @@ function session_get_instance() {
 
     static $session = null;
 
+    if (!defined('NO_MOODLE_COOKIES')) {
+        // Moodle session was not initialised yet in lib/setup.php.
+        $session = new emergency_session();
+        return $session;
+    }
+
     if (is_null($session)) {
         if (empty($CFG->sessiontimeout)) {
             $CFG->sessiontimeout = 7200;