auto clean old ops
authorx2000habouzit <x2000habouzit>
Sun, 7 Nov 2004 11:58:16 +0000 (11:58 +0000)
committerx2000habouzit <x2000habouzit>
Sun, 7 Nov 2004 11:58:16 +0000 (11:58 +0000)
scripts/cron/clean.php
scripts/migration/0.9.2/notifs.sql

index 1cd6bf3..7fec83d 100755 (executable)
@@ -19,7 +19,7 @@
  *  Foundation, Inc.,                                                      *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************
-        $Id: clean.php,v 1.3 2004-10-02 15:34:53 x2000habouzit Exp $
+        $Id: clean.php,v 1.4 2004-11-07 11:58:16 x2000habouzit Exp $
  ***************************************************************************/
 
 require('./connect.db.inc.php');
@@ -31,6 +31,10 @@ function query ($sql) {
     }
 }
 
+// la table des notifs est nettoyée
+$eight_days_ago = date("YmdHis",mktime() - 8*24*60*60);
+query("DELETE FROM watch_ops WHERE known>$eight_days_ago");
+
 // la table en_cours est nettoyée
 query("DELETE FROM en_cours WHERE TO_DAYS(NOW()) - TO_DAYS(date) >= 365");
 query("delete from en_cours where loginbis = 'INSCRIT'");
index 76ef9c0..4b04f1c 100644 (file)
@@ -21,7 +21,8 @@ create table watch_ops (
     known timestamp not null,
     date date not null,
     info varchar(255),
-    primary key (uid,cid)
+    primary key (uid,cid),
+    index (known)
 );
 
 create table watch_sub (