]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-11466 - failing to check for the case $rs = false in the accesslib performance...
authortjhunt <tjhunt>
Wed, 26 Sep 2007 21:31:54 +0000 (21:31 +0000)
committertjhunt <tjhunt>
Wed, 26 Sep 2007 21:31:54 +0000 (21:31 +0000)
lib/datalib.php

index 22d15b605334776795e8cd53d4e3f34f86e030c9..cdbfc931a0d268626f078fb462a92ab0a6d9aa4c 100644 (file)
@@ -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)) {