summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Grossenbacher2010-03-22 07:13:19 (GMT)
committer Sascha Grossenbacher2010-03-22 07:13:19 (GMT)
commitd3b6c0a9cf9628d2f6ee6ef3e10e9d13eccfc60a (patch)
tree1635020554275c51bdebb11a384cf07ccf34d623
parentdde374a29ef36fc98b87a81058d5c1e1fc7ab75b (diff)
#746650 by Berdir: Fixed wrong group by in Inbox tag update/batch function.
-rw-r--r--privatemsg_filter/privatemsg_filter.admin.inc4
1 files changed, 2 insertions, 2 deletions
diff --git a/privatemsg_filter/privatemsg_filter.admin.inc b/privatemsg_filter/privatemsg_filter.admin.inc
index 4c10947..a7f0c73 100644
--- a/privatemsg_filter/privatemsg_filter.admin.inc
+++ b/privatemsg_filter/privatemsg_filter.admin.inc
@@ -252,14 +252,14 @@ function privatemsg_filter_inbox_rebuild_process(&$context) {
}
// Fetch the 10 next thread_ids.
- $threads = db_query_range('SELECT DISTINCT thread_id FROM {pm_index} WHERE thread_id > :thread_id', 0, 20, array(':thread_id' => $context['sandbox']['current_thread_id']))->fetchCol();
+ $threads = db_query_range('SELECT DISTINCT thread_id FROM {pm_index} WHERE thread_id > :thread_id ORDER BY thread_id ASC', 0, 20, array(':thread_id' => $context['sandbox']['current_thread_id']))->fetchCol();
if (!empty($threads)) {
// By limiting this slow query (having condition with 2 depending subqueries)
// on a specific set of threads, this allows us to process the slow having
// part on a relatively small subset of pm_index that can be selected based on
// the thread_id index.
- $sql = 'SELECT pmi.thread_id, pmi.uid FROM pm_index pmi WHERE thread_id IN (:threads) GROUP BY pmi.uid HAVING ((SELECT pmf.author FROM pm_message pmf WHERE pmf.mid = pmi.thread_id) = pmi.uid AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM pm_message pmf INNER JOIN pm_index pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> pmi.uid) > 0';
+ $sql = 'SELECT pmi.thread_id, pmi.uid FROM pm_index pmi WHERE thread_id IN (:threads) GROUP BY pmi.thread_id, pmi.uid HAVING ((SELECT pmf.author FROM pm_message pmf WHERE pmf.mid = pmi.thread_id) = pmi.uid AND COUNT(pmi.thread_id) > 1) OR (SELECT COUNT(*) FROM pm_message pmf INNER JOIN pm_index pmif ON (pmf.mid = pmif.mid) WHERE pmif.thread_id = pmi.thread_id AND pmf.author <> pmi.uid) > 0';
$result = db_query($sql, array(':threads' => $threads));
foreach ($result as $row) {
// $row is an object with uid property, so we pass it to the function as a