MDL-56635 tags: use recordset since component may not be unique
authorMarina Glancy <marina@moodle.com>
Fri, 16 Feb 2018 01:50:57 +0000 (09:50 +0800)
committerMarina Glancy <marina@moodle.com>
Fri, 16 Feb 2018 01:50:57 +0000 (09:50 +0800)
lib/classes/task/tag_cron_task.php

index 721edfb..5be4bb1 100644 (file)
@@ -184,7 +184,7 @@ class tag_cron_task extends scheduled_task {
         $sql = "SELECT DISTINCT component, itemtype
                   FROM {tag_instance}
                  WHERE itemtype <> 'user' or component <> 'core'";
-        $tagareas = $DB->get_records_sql($sql);
+        $tagareas = $DB->get_recordset_sql($sql);
         foreach ($tagareas as $tagarea) {
             $sql = 'SELECT ti.id
                       FROM {tag_instance} ti
@@ -196,6 +196,7 @@ class tag_cron_task extends scheduled_task {
                 $tagarray[] = $tagid->id;
             }
         }
+        $tagareas->close();
 
         // Get instances for each of the ids to be deleted.
         if (count($tagarray) > 0) {