Branch: Tag:

2007-05-16

2007-05-16 07:10:12 by Fredrik Noring <noring@nocrew.org>

Implemented automatic purge of eventlog (by default entries older than 7 days).

Rev: lib/modules/Search.pmod/Utils.pmod:1.46

1:   // This file is part of Roxen Search   // Copyright © 2001 Roxen IS. All rights reserved.   // - // $Id: Utils.pmod,v 1.45 2007/03/15 13:28:45 jonasw Exp $ + // $Id: Utils.pmod,v 1.46 2007/05/16 07:10:12 noring Exp $      #if !constant(report_error)   #define report_error werror
716:    extra?sprintf(codes[(int)code], @(extra/"\n")):codes[(int)code]));    }    +  void log_purge(int days) +  { +  Sql.Sql db = get_db(); +  if(!db) return; +  if(days) +  db->query("DELETE FROM eventlog " +  " WHERE at <= NOW() - INTERVAL "+days+" DAY"); +  else +  db->query("DELETE FROM eventlog"); +  } +     //!    void log_event( int code, string type, void|string extra, void|int log_profile ) {    Sql.Sql db = get_db();