MDL-33788 completion: SQL optimisation
authorAaron Barnes <aaronb@catalyst.net.nz>
Sat, 16 Jun 2012 10:47:48 +0000 (22:47 +1200)
committerAaron Barnes <aaronb@catalyst.net.nz>
Mon, 9 Jul 2012 03:22:32 +0000 (15:22 +1200)
lib/completion/cron.php

index 3645c06..bf2a646 100644 (file)
@@ -377,10 +377,11 @@ function completion_cron_completions() {
         SET
             reaggregate = 0
         WHERE
         SET
             reaggregate = 0
         WHERE
-            reaggregate < {$timestarted}
+            reaggregate < :timestarted
+        AND reaggregate > 0
     ";
 
     ";
 
-    $DB->execute($sql);
+    $DB->execute($sql, array('timestarted' => $timestarted));
 }
 
 /**
 }
 
 /**