From: tjhunt Date: Wed, 26 Sep 2007 21:31:54 +0000 (+0000) Subject: MDL-11466 - failing to check for the case $rs = false in the accesslib performance... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3b0ee367a79150aa367ec812a2184bd68fe32523;p=moodle.git MDL-11466 - failing to check for the case $rs = false in the accesslib performance improvements. Credit for the fix goes to Gareth Morgan. --- diff --git a/lib/datalib.php b/lib/datalib.php index 22d15b6053..cdbfc931a0 100644 --- a/lib/datalib.php +++ b/lib/datalib.php @@ -1240,8 +1240,7 @@ function get_categories($parent='none', $sort=NULL, $shallow=true) { } $categories = array(); - $rs = get_recordset_sql($sql); - if ($rs->RecordCount()) { + if( $rs = get_recordset_sql($sql) ){ while ($cat = rs_fetch_next_record($rs)) { $cat = make_context_subobj($cat); if ($cat->visible || has_capability('moodle/course:create',$cat->context)) {