From: moodler Date: Wed, 13 Sep 2006 08:09:18 +0000 (+0000) Subject: Added some checking that should not be necessary but I had notices in one extreme... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3d1885af1e7ad42bd8fb88ce2bda3f95786895e9;p=moodle.git Added some checking that should not be necessary but I had notices in one extreme situation --- diff --git a/lib/dmllib.php b/lib/dmllib.php index ae4d50a61e..da36bc89d6 100644 --- a/lib/dmllib.php +++ b/lib/dmllib.php @@ -593,6 +593,10 @@ function get_recordset_sql($sql, $limitfrom=null, $limitnum=null) { global $CFG, $db; + if (empty($db)) { + return false; + } + if (defined('MDL_PERFDB')) { global $PERF ; $PERF->dbqueries++; }; if ($limitfrom || $limitnum) { @@ -994,6 +998,10 @@ function insert_record($table, $dataobject, $returnid=true, $primarykey='id') { global $db, $CFG, $empty_rs_cache; + if (empty($db)) { + return false; + } + /// DIRTY HACK: Implement one cache to store meta data (needed by Oracle inserts) /// TODO: Possibly make it global to benefit other functions needing it (update_record...) if (!isset($metadatacache)) {