diff --git a/public/lib/db/upgrade.php b/public/lib/db/upgrade.php index f3a538f28a2..25ac2e89460 100644 --- a/public/lib/db/upgrade.php +++ b/public/lib/db/upgrade.php @@ -1490,7 +1490,7 @@ function xmldb_main_upgrade($oldversion) { FROM {customfield_data} d JOIN {customfield_field} f ON d.fieldid = f.id JOIN {customfield_category} c ON f.categoryid = c.id"; - $records = $DB->get_records_sql($sql); + $records = $DB->get_recordset_sql($sql); foreach ($records as $r) { $DB->update_record('customfield_data', (object)[ @@ -1501,6 +1501,8 @@ function xmldb_main_upgrade($oldversion) { ]); } + $records->close(); + // Define table customfield_shared to be created. $table = new xmldb_table('customfield_shared');