X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fcron_validations.php;h=bbaf0009db87d9c1048419c5407c8c61b435cec0;hb=3424387cde6c635ff16c3b5459c4caa88bb76e2e;hp=bdf7330c5f3583ca1501ced550130a0e51483344;hpb=b032b01b8919b36ec66f8a0395132953d8c01cf2;p=platal.git diff --git a/bin/cron/cron_validations.php b/bin/cron/cron_validations.php index bdf7330..bbaf000 100755 --- a/bin/cron/cron_validations.php +++ b/bin/cron/cron_validations.php @@ -1,7 +1,7 @@ #!/usr/bin/php5 -q fetchOneRow(); $age = (time() - intval($age)) / 86400; -$head = ""; +$head = ''; if ($age > 15) { $head = "[Autodestruction du serveur] "; } elseif ($age > 7) { @@ -55,30 +56,31 @@ if (empty($nb)) { exit; } -$plural = $nb == 1 ? "" : "s"; +$plural = $nb == 1 ? '' : 's'; $mymail = new PlMailer(); $mymail->setFrom('validation@' . $globals->mail->domain); -$mymail->addTo("validation@" . $globals->mail->domain); +$mymail->addTo('validation@' . $globals->mail->domain); $mymail->setSubject($head . "Il y a $nb validation$plural non effectuée$plural"); $message = "Il y a $nb validation$plural à effectuer\n" - .(empty($nbold)?"":"dont $nbold depuis le dernier mail !!!\n") - .(empty($nbveryold)?"":"et dont *$nbveryold* ".($nbveryold == 1 ? "est" : "sont")." en retard de plus de 6h !!!") - ."\n" - ."https://www.polytechnique.org/admin/validate\n\n" - ."Par catégorie :\n"; -$res = XDB::iterRow("SELECT type, count(*) - FROM x4dat.requests + . (empty($nbold) ? '' : "dont $nbold depuis le dernier mail !!!\n") + . (empty($nbveryold) ? '' : "et dont *$nbveryold* " . ($nbveryold == 1 ? 'est' : 'sont') . ' en retard de plus de 6h !!!') + . "\n" + . "https://www.polytechnique.org/admin/validate\n\n" + . "Par catégorie :\n"; +$res = XDB::iterRow('SELECT type, count(*) + FROM requests GROUP BY type - ORDER BY type"); + ORDER BY type'); while (list($type, $nb) = $res->next()) { $message .= "- $type : $nb\n"; } -$message = wordwrap($message,78); +$message = wordwrap($message, 78); $mymail->setTxtBody($message); $mymail->send(); -// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8: ?>