summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhosef2017-04-22 21:58:04 (GMT)
committerJason Flatt2017-04-22 21:58:04 (GMT)
commit6f0dbc74c70bde4aa522405f53e2801dc01f91e7 (patch)
treeddd5553bc638db5df07ebe7b7086a1914f7c591a
parentc6768eb6954457808ca44df99b90aa7f1ef1bb58 (diff)
Issue #2659226 by hosef, oadaeh, Kristen Pol: Improve the performance of the message flushing cron job
-rwxr-xr-xprivatemsg.module7
1 files changed, 3 insertions, 4 deletions
diff --git a/privatemsg.module b/privatemsg.module
index ac9b8a7..8c9ecf2 100755
--- a/privatemsg.module
+++ b/privatemsg.module
@@ -1241,12 +1241,11 @@ function privatemsg_sql_autocomplete($search, $names) {
* @see hook_query_privatemsg_deleted_alter()
*/
function privatemsg_sql_deleted($days, $max) {
- $query = db_select('pm_message', 'pm');
- $query->addField('pm', 'mid');
+ $query = db_select('pm_index', 'pmi');
+ $query->addField('pmi', 'mid');
- $query->join('pm_index', 'pmi', 'pmi.mid = pm.mid');
return $query
- ->groupBy('pm.mid')
+ ->groupBy('pmi.mid')
->having('MIN(pmi.deleted) > 0 AND MAX(pmi.deleted) < :old', array(':old' => REQUEST_TIME - $days * 86400))
->range(0, $max);
}