X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fcron_ml_moderate.php;h=e77643dcc4b31f6683d6b0225ee946259120b858;hb=3731beb2ec0ae6e363dd348011aa48ecc31106d6;hp=268cdd358586af1dbe3b1a9648247ea0d5d0eec6;hpb=0073747ac81cc9cff9e43847eb008f0e815255f0;p=platal.git diff --git a/bin/cron/cron_ml_moderate.php b/bin/cron/cron_ml_moderate.php index 268cdd3..e77643d 100755 --- a/bin/cron/cron_ml_moderate.php +++ b/bin/cron/cron_ml_moderate.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q lists->max_mail_per_min && time() - $handler < 60) { // take a lock on a mail - XDB::execute("UPDATE email_list_moderate + XDB::execute('UPDATE email_list_moderate SET handler = {?} WHERE handler IS NULL ORDER BY ts - LIMIT 1", $handler); + LIMIT 1', $handler); if (XDB::affectedRows() == 0) { break; } - $query = XDB::query('SELECT a.fullname, a.uid, a.password, + $query = XDB::query('SELECT a.full_name, a.uid, a.password, ml.ml, ml.domain, ml.mid, ml.action, ml.message - FROM accounts AS a + FROM accounts AS a INNER JOIN email_list_moderate AS ml ON (a.uid = ml.uid) WHERE ml.handler = {?}', $handler); list($fullname, $uid, $password, $list, $domain, $mid, $action, $reason) = $query->fetchOneRow(); @@ -48,7 +53,7 @@ while ($sent_mails < $globals->lists->max_mail_per_min $client = new MMList($uid, $password, $domain); // send the mail - $mail = $client->get_pending_mail($list, $mid); + $mail = $client->get_pending_mail($list, $mid); list($det,$mem,$own) = $client->get_members($list); $count = 0; switch ($action) { @@ -70,7 +75,7 @@ while ($sent_mails < $globals->lists->max_mail_per_min $action = 3; /** 3 = DISCARD **/ $subject = "Message supprimé"; $append = "a été supprimé par $fullname.\n\n" - . "Rappel: il ne faut utiliser cette opération " + . "Rappel : il ne faut utiliser cette opération " . "que dans le cas de spams ou de virus !\n"; $type = 'spam'; $count += count($own); @@ -115,7 +120,8 @@ while ($sent_mails < $globals->lists->max_mail_per_min } // release the lock - XDB::execute("DELETE FROM email_list_moderate WHERE handler = {?}", + XDB::execute('DELETE FROM email_list_moderate + WHERE handler = {?}', $handler); sleep(60 * $count / $globals->lists->max_mail_per_min); }