From ab0c861479c5effcc5325ecd5e171e6b4f62e149 Mon Sep 17 00:00:00 2001 From: "Andrew Davis (andyjdavis)" Date: Tue, 7 Jun 2011 17:06:00 +0800 Subject: [PATCH] MDL-24355 tag: added code to prevent an error if there are no tag correlations found --- tag/lib.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tag/lib.php b/tag/lib.php index 12ae1ea9170..815366cddc2 100644 --- a/tag/lib.php +++ b/tag/lib.php @@ -824,7 +824,12 @@ function tag_compute_correlations($mincorrelation = 2) { rs_close($rs); // Remove any correlations that weren't just identified - delete_records_select('tag_correlation', 'id NOT IN ('.join(',', $correlations).')'); + if (empty($correlations)) { + //there are no correlations so delete any in the database + delete_records('tag_correlation'); + } else { + delete_records_select('tag_correlation', 'id NOT IN ('.join(',', $correlations).')'); + } } /**