]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 fixing old TODO, get_record now throws exception on error
authorPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 09:31:09 +0000 (09:31 +0000)
committerPetr Skoda <skodak@moodle.org>
Sun, 1 Nov 2009 09:31:09 +0000 (09:31 +0000)
lib/accesslib.php

index d12cbfa961fd35c312b5d6d74d5292b0c7cf6e99..83833b7e47e7846fc2cbb6289194f796c0a43529 100755 (executable)
@@ -2250,13 +2250,7 @@ function get_system_context($cache=true) {
         return $ACCESSLIB_PRIVATE->systemcontext;
     }
     try {
-        // TODO: can not use get_record() because we do not know if query failed :-(
-        //       switch to get_record() later
-        $contextarr = $DB->get_records('context', array('contextlevel'=>CONTEXT_SYSTEM));
-        if ($contextarr === false) {
-            return null;
-        }
-        $context = $contextarr ? reset($contextarr) : null;
+        $context = $DB->get_record('context', array('contextlevel'=>CONTEXT_SYSTEM));
     } catch (dml_exception $e) {
         //table does not exist yet, sorry
         return null;