Adapts plat/al crons to the new database.
[platal.git] / bin / cron / notifs.send.php
index 1d5ceca..a9958e4 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/php5 -q
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -20,9 +20,9 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('connect.db.inc.php');
-require_once('plmailer.php');
-require_once('notifs.inc.php');
+require_once 'connect.db.inc.php';
+require_once 'plmailer.php';
+require_once 'notifs.inc.php';
 
 $all = new AllNotifs();
 
@@ -36,8 +36,11 @@ foreach ($all->_data as $u) {
     $mailer->send($u['mail_fmt'] == 'html');
 }
 
-XDB::execute("DELETE FROM  watch_profile
-                    WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)");
+XDB::execute("UPDATE  watch_profile
+                 SET  ts = NOW()
+               WHERE  field = 'broken'");
+XDB::execute('DELETE FROM  watch_profile
+                    WHERE  ts < DATE_SUB(CURRENT_DATE, INTERVAL 15 DAY)');
 
 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>