MDL-25708 recordsets - url module
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 22 Jan 2011 11:54:40 +0000 (12:54 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Sat, 22 Jan 2011 11:54:40 +0000 (12:54 +0100)
mod/url/db/upgradelib.php

index 8ff7adc..8478faf 100644 (file)
@@ -50,7 +50,9 @@ function url_20_migrate() {
         return;
     }
 
-    if (!$candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0))) {
+    $candidates = $DB->get_recordset('resource_old', array('type'=>'file', 'migrated'=>0));
+    if (!$candidates->valid()) {
+        $candidates->close(); // Not going to iterate (but exit), close rs
         return;
     }
 
@@ -135,4 +137,4 @@ function url_20_migrate() {
 
     // clear all course modinfo caches
     rebuild_course_cache(0, true);
-}
\ No newline at end of file
+}