Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions public_html/lists/admin/actions/processqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -897,6 +897,12 @@ function sendEmailTest($messageid, $email)
);
}

//# this allows plugins to change the order in which the subscribers are
//# processed, by adding an "order by" clause to the query
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$query = $plugin->processQueueUserSelectQuery($query, $messageid);
}

if (VERBOSE) {
processQueueOutput('User select query '.$query);
}
Expand Down Expand Up @@ -938,6 +944,9 @@ function sendEmailTest($messageid, $email)
//# rerun the initial query, in order to continue as normal
$query = sprintf('select userid from '.$tables['usermessage'].' where messageid = %d and status = "todo"',
$messageid);
foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
$query = $plugin->processQueueUserSelectQuery($query, $messageid);
}
$userids = Sql_Query($query);
$counters['total_users_for_message '.$messageid] = Sql_Affected_Rows();
}
Expand Down
16 changes: 16 additions & 0 deletions public_html/lists/admin/defaultplugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,22 @@ public function processQueueStart()
{
}

/**
* processQueueUserSelectQuery
* called with the query that selects the subscribers of a campaign, just
* before that query is run
* allows a plugin to change the order in which subscribers are processed,
* for example to interleave imported segments instead of sending in
* database order
* @param string query the query that is about to be run
* @param int messageid the campaign being processed
* @return string the query to run
*/
public function processQueueUserSelectQuery($query, $messageid)
{
return $query;
}

/**
* allowProcessQueue
* called at the beginning of processQueue
Expand Down