From: Raphaël Barrois Date: Wed, 3 Nov 2010 22:13:48 +0000 (+0100) Subject: Cleaner queries while sending NL X-Git-Tag: xorg/1.0.2~32^2~25 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=e0f07e78801618744e1aa64d8af4e719b49cf409;p=platal.git Cleaner queries while sending NL Signed-off-by: Raphaël Barrois --- diff --git a/include/massmailer.inc.php b/include/massmailer.inc.php index c866f90..8c132a1 100644 --- a/include/massmailer.inc.php +++ b/include/massmailer.inc.php @@ -209,18 +209,19 @@ abstract class MassMailer $emailsCount = 0; while (true) { + $sent = array(); $users = User::getBulkUsersWithUIDs(XDB::fetchColumn($query)); if (count($users) == 0) { return $emailsCount; } foreach ($users as $user) { - $sent[] = XDB::format('uid = {?}', $user->id()); + $sent[] = $user->id(); $this->sendTo($user, $hash); ++$emailsCount; } XDB::execute("UPDATE {$this->_subscriptionTable} SET last = {?} - WHERE " . implode(' OR ', $sent), $this->_id); + WHERE uid IN {?}", $this->_id, $sent); sleep(60); }