1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-19 04:41:53 +02:00

Corrected email 'pause' timing on mailout cron job.

This commit is contained in:
Cameron
2014-10-27 20:33:35 -07:00
parent 41ee837c7e
commit 38ff75d27e
2 changed files with 22 additions and 7 deletions

View File

@@ -123,7 +123,7 @@ class e107MailManager
const E107_EMAIL_MAX_TRIES = 3; // Maximum number of tries by us (mail server may do more)
// - max allowable value is MAIL_STATUS_MAX_ACTIVE - MAIL_STATUS_PENDING
private $debugMode = 1;
private $debugMode = false;
protected $e107;
protected $db = NULL; // Use our own database object - this one for reading data
protected $db2 = NULL; // Use our own database object - this one for updates
@@ -902,16 +902,26 @@ class e107MailManager
* Call to do a number of 'units' of email processing - from a cron job, for example
* Each 'unit' sends one email from the queue - potentially it could do some other task.
* @param $limit - number of units of work to do - zero to clear the queue (or do maximum allowed by a hard-coded limit)
* @param $pauseCount - pause after so many emails
* @param $pauseTime - time in seconds to pause after 'pauseCount' number of emails.
* @return None
*/
public function doEmailTask($limit = 0)
public function doEmailTask($limit = 0, $pauseCount=null, $pauseTime=1)
{
if ($count = $this->selectEmails($limit))
{
$c=1;
while ($count > 0)
{
$this->sendNextEmail();
$count--;
if(!empty($pauseCount) && ($c === $pauseCount))
{
sleep($pauseTime);
$c=1;
}
}
if ($this->mailer)
{