From: Florent Bruneau Date: Thu, 12 Feb 2009 21:54:31 +0000 (+0100) Subject: And so on. X-Git-Tag: xorg/1.0.0~332^2~373 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=2d88346f4b0d60bf0d7e1d340a2dfd6535ed5b82;p=platal.git And so on. Signed-off-by: Florent Bruneau --- diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index 95748f6..decda36 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -190,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) @@ -206,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); } diff --git a/modules/axletter/axletter.inc.php b/modules/axletter/axletter.inc.php index 385365e..7cf486e 100644 --- a/modules/axletter/axletter.inc.php +++ b/modules/axletter/axletter.inc.php @@ -96,26 +96,6 @@ class AXLetter extends MassMailer WHERE id={?}", $this->_id); } - protected function getAllRecipients() - { - global $globals; - return "SELECT ni.user_id, IF(ni.user_id = 0, NULL, u.hruid) AS hruid, - IF(ni.user_id = 0, ni.email, CONCAT(a.alias, '@{$globals->mail->domain}')) AS alias, - IF(ni.user_id = 0, ni.prenom, u.prenom) AS prenom, - IF(ni.user_id = 0, ni.nom, IF(u.nom_usage='', u.nom, u.nom_usage)) AS nom, - FIND_IN_SET('femme', IF(ni.user_id = 0, ni.flag, u.flags)) AS sexe, - IF(ni.user_id = 0, 'html', q.core_mail_fmt) AS pref, - IF(ni.user_id = 0, ni.hash, 0) AS hash - FROM axletter_ins AS ni - LEFT JOIN auth_user_md5 AS u USING(user_id) - LEFT JOIN auth_user_quick AS q ON(q.user_id = u.user_id) - LEFT JOIN aliases AS a ON(u.user_id=a.id AND FIND_IN_SET('bestalias',a.flags)) - LEFT JOIN emails AS e ON(e.uid=u.user_id AND e.flags='active') - WHERE ni.last < {?} AND {$this->subscriptionWhere()} - AND (e.email IS NOT NULL OR FIND_IN_SET('googleapps', u.mail_storage) OR ni.user_id = 0) - GROUP BY u.user_id"; - } - static public function subscriptionState($uid = null) { $user = is_null($uid) ? S::v('uid') : $uid;