From 6bc6757084411adaaf25b765109cae2c8568632b Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 16 Feb 2018 09:50:57 +0800 Subject: [PATCH] MDL-56635 tags: use recordset since component may not be unique --- lib/classes/task/tag_cron_task.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/classes/task/tag_cron_task.php b/lib/classes/task/tag_cron_task.php index 721edfbc95f..5be4bb1a473 100644 --- a/lib/classes/task/tag_cron_task.php +++ b/lib/classes/task/tag_cron_task.php @@ -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) {