Skip to content

Commit

Permalink
* refactored the loop
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.php.net/repository/pear/packages/Mail_Queue/trunk@303876 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information
till committed Sep 29, 2010
1 parent 8e5cebe commit 2a16f71
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions Mail/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,27 +389,29 @@ function sendMailsInQueue($limit = MAILQUEUE_ALL, $offset = MAILQUEUE_START,
MAILQUEUE_ERROR_CANNOT_SEND_MAIL, PEAR_ERROR_TRIGGER,
E_USER_NOTICE
);
} else {
//take care of callback first, as it may need to retrieve extra data
//from the mail_queue table.
if ($callback !== null) {
$queued_as = null;
$greeting = null;
if (isset($this->queued_as)) {
$queued_as = $this->queued_as;
}
if (isset($this->greeting)) {
$greeting = $this->greeting;
}
call_user_func($callback,
array('id' => $mail->getId(),
'queued_as' => $queued_as,
'greeting' => $greeting));
continue;
}

//take care of callback first, as it may need to retrieve extra data
//from the mail_queue table.
if ($callback !== null) {
$queued_as = null;
$greeting = null;
if (isset($this->queued_as)) {
$queued_as = $this->queued_as;
}
if ($mail->isDeleteAfterSend()) {
$status = $this->deleteMail($mail->getId());
var_dump($status);
if (isset($this->greeting)) {
$greeting = $this->greeting;
}
call_user_func($callback,
array('id' => $mail->getId(),
'queued_as' => $queued_as,
'greeting' => $greeting));
}

// delete email from queue?
if ($mail->isDeleteAfterSend()) {
$status = $this->deleteMail($mail->getId());
}

unset($mail);
Expand Down

0 comments on commit 2a16f71

Please sign in to comment.