X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fmassmailer.inc.php;h=decda36ba9b4f19ca2cf4c216cfde6684eb0ccb2;hb=671b7073a0debbd347e7276f44fa04c961693f4c;hp=939c7fb0015b5d7ffc879288b6632c38a05c44f4;hpb=be638e733bce413df4324d985297d9a4d94dcbca;p=platal.git diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index 939c7fb..decda36 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -19,6 +19,13 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +// {{{ class MailNotFound + +class MailNotFound extends Exception { +} + +// }}} + // {{{ class MassMailer abstract class MassMailer @@ -183,8 +190,7 @@ abstract class MassMailer protected function getAllRecipients() { global $globals; - return "SELECT a.uid, a.hruid, a.display_name, a.full_name, a.email_format, - ni.hash AS hash + return "SELECT a.uid FROM {$this->_subscriptionTable} AS ni INNER JOIN accounts AS a ON (ni.user_id = a.uid) LEFT JOIN email_options AS eo ON (eo.uid = a.uid) @@ -199,12 +205,11 @@ abstract class MassMailer $this->setSent(); $query = XDB::format($this->getAllRecipients(), $this->id()) . ' LIMIT 60'; while (true) { - $res = XDB::iterRow($query); - if (!$res->total()) { + $users = User::getBulkUsersWithUIDs(XDB::fetchColumn($query)); + if (count($users) == 0) { return; } - while ($infos = $res->next()) { - $user = User::getSilentWithValues(null, $infos); + foreach ($users as $user) { $sent[] = XDB::format('user_id = {?}', $user->id()); $this->sendTo($user, $hash); }