From: Stéphane Jacob Date: Wed, 5 May 2010 07:39:41 +0000 (+0200) Subject: Adds email count in massmailer and displays it in the axletter notification email. X-Git-Tag: xorg/1.0.0~269 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=16925f019deb7ab114f91dc623897103ba708d01;p=platal.git Adds email count in massmailer and displays it in the axletter notification email. Signed-off-by: Stéphane Jacob --- diff --git a/bin/cron/axletter.send.php b/bin/cron/axletter.send.php index eabf91d..e6bbcda 100755 --- a/bin/cron/axletter.send.php +++ b/bin/cron/axletter.send.php @@ -20,15 +20,16 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once('./connect.db.inc.php'); -require_once("../../modules/axletter/axletter.inc.php"); +require_once './connect.db.inc.php'; +require_once '../../modules/axletter/axletter.inc.php'; $al = AXLetter::toSend(); if ($al) { echo "Envoi de la lettre \"{$al->title()}\"\n\n"; - echo " " . date("H:i:s") . " -> début de l'envoi\n"; - $al->sendToAll(); - echo " " . date("H:i:s") . " -> fin de l'envoi\n"; + echo ' ' . date("H:i:s") . " -> début de l'envoi\n"; + $emailsCount = $al->sendToAll(); + echo ' ' . date("H:i:s") . " -> fin de l'envoi\n\n"; + echo $emailsCount . "emails ont été envoyés lors de cet envoi.\n"; } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index f9cc381..3dde660 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -204,14 +204,17 @@ abstract class MassMailer { $this->setSent(); $query = XDB::format($this->getAllRecipients(), $this->id()) . ' LIMIT 60'; + $emailsCount = 0; + while (true) { $users = User::getBulkUsersWithUIDs(XDB::fetchColumn($query)); if (count($users) == 0) { - return; + return $emailsCount; } foreach ($users as $user) { $sent[] = XDB::format('uid = {?}', $user->id()); $this->sendTo($user, $hash); + ++$emailsCount; } XDB::execute("UPDATE {$this->_subscriptionTable} SET last = {?}