]> git.mjollnir.org Git - moodle.git/commitdiff
fixed notice during upgrade from 1.8
authorskodak <skodak>
Mon, 24 Sep 2007 19:00:39 +0000 (19:00 +0000)
committerskodak <skodak>
Mon, 24 Sep 2007 19:00:39 +0000 (19:00 +0000)
lib/accesslib.php

index e4040e1e3cb869647229d7d625100478e6782cbc..1818e0d0f4c2b3bb87c58ab58fa348862332e7ef 100755 (executable)
@@ -228,15 +228,16 @@ function get_role_access($roleid, $accessdata=NULL) {
             WHERE rc.roleid = {$roleid}
                   AND ctx.contextlevel <= ".CONTEXT_COURSE."
             ORDER BY ctx.depth, ctx.path";
-    $rs = get_recordset_sql($sql);
-    if ($rs->RecordCount()) {
-        while ($rd = rs_fetch_next_record($rs)) {
-            $k = "{$rd->path}:{$roleid}";
-            $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
+    if ($rs = get_recordset_sql($sql)) {
+        if ($rs->RecordCount()) {
+            while ($rd = rs_fetch_next_record($rs)) {
+                $k = "{$rd->path}:{$roleid}";
+                $accessdata['rdef'][$k][$rd->capability] = $rd->permission;
+            }
+            unset($rd);
         }
-        unset($rd);
+        rs_close($rs);
     }
-    rs_close($rs);
 
     return $accessdata;
 }