X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=bin%2Fcron%2Fcron_validations.php;h=4cab46718ed01ace2d4aafc3a2ab91dcf6b87208;hb=b9ad087851ce4a09236f64f67d15fdaf29e38cf0;hp=3768240948e507ca460860c6ad35031fe653fea0;hpb=a7de4ef724d1a3b0bf978a50ce7cc9d23412c7a0;p=platal.git diff --git a/bin/cron/cron_validations.php b/bin/cron/cron_validations.php index 3768240..4cab467 100755 --- a/bin/cron/cron_validations.php +++ b/bin/cron/cron_validations.php @@ -21,7 +21,7 @@ ***************************************************************************/ /* vim: set sw=4 ts=4 sts=4 tw=100: * vérifie qu'il n'y a pas de validations en cours, et maile si c'est le cas -*/ +*/ $M_PERIOD = "INTERVAL 3 HOUR"; // période d'envoi des mails de 3h $R_PERIOD = "INTERVAL 6 HOUR"; // période de réponse moyenne de 6h @@ -36,19 +36,29 @@ if (empty($nb)) { exit; } +$plural = $nb == 1 ? "" : "s"; + $mymail = new PlMailer(); -$mymail->setFrom('validation@polytechnique.org'); -$mymail->addTo("validation@polytechnique.org"); -$mymail->setSubject((empty($nbveryold)?"":"[urgent] ")."il y a $nb validations non effectuées"); +$mymail->setFrom('validation@' . $globals->mail->domain); +$mymail->addTo("validation@" . $globals->mail->domain); +$mymail->setSubject((empty($nbveryold)?"":"[urgent] ")."il y a $nb validation$plural non effectuée$plural"); $message = - "il y a $nb validation à effectuer \n" + "il y a $nb validation$plural à effectuer \n" .(empty($nbold)?"":"dont $nbold depuis le dernier mail !!!\n") - .(empty($nbveryold)?"":"et dont *$nbveryold* sont en retard de plus de 6h !!!") + .(empty($nbveryold)?"":"et dont *$nbveryold* ".($nbveryold == 1 ? "est" : "sont")." en retard de plus de 6h !!!") ."\n" - ."https://www.polytechnique.org/admin/validate\n"; + ."https://www.polytechnique.org/admin/validate\n\n" + ."Par catégorie :\n"; +$res = XDB::iterRow("SELECT type, count(*) + FROM x4dat.requests + GROUP 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: