From 4e438f39e4d96f7bddc8cf38fb5f36b68cc20033 Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Sun, 7 Nov 2004 11:58:16 +0000 Subject: [PATCH] auto clean old ops --- scripts/cron/clean.php | 6 +++++- scripts/migration/0.9.2/notifs.sql | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/cron/clean.php b/scripts/cron/clean.php index 1cd6bf3..7fec83d 100755 --- a/scripts/cron/clean.php +++ b/scripts/cron/clean.php @@ -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'"); diff --git a/scripts/migration/0.9.2/notifs.sql b/scripts/migration/0.9.2/notifs.sql index 76ef9c0..4b04f1c 100644 --- a/scripts/migration/0.9.2/notifs.sql +++ b/scripts/migration/0.9.2/notifs.sql @@ -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 ( -- 2.1.4