From: Petr Skoda Date: Sun, 1 Nov 2009 09:31:09 +0000 (+0000) Subject: MDL-14679 fixing old TODO, get_record now throws exception on error X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=df97c6ee575d57034c137ab1dca25f902149a726;p=moodle.git MDL-14679 fixing old TODO, get_record now throws exception on error --- diff --git a/lib/accesslib.php b/lib/accesslib.php index d12cbfa961..83833b7e47 100755 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -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;