source: companies/celepar/phpgwapi/cron/clean_phpgw_tables.php @ 763

Revision 763, 1.0 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

Line 
1#!/usr/bin/php -q
2<?php
3        $path_to_egroupware = realpath(dirname(__FILE__).'/../..');     //  need to be adapted if this script is moved somewhere else
4
5        $GLOBALS['phpgw_info']['flags'] = array(
6                'currentapp' => 'login',
7                'noapi'      => True            // this stops header.inc.php to include phpgwapi/inc/function.inc.php
8        );
9        if (!is_readable($path_to_egroupware.'/header.inc.php'))
10        {
11                echo $msg = "Could not find '$path_to_egroupware/header.inc.php', exiting !!!\n";
12                exit(1);
13        }
14
15        include($path_to_egroupware.'/header.inc.php');
16        unset($GLOBALS['phpgw_info']['flags']['noapi']);
17
18        include(PHPGW_API_INC.'/functions.inc.php');
19
20        if ($GLOBALS['phpgw_info']['server']['max_access_log_age'])
21                $max_age = time() - ($GLOBALS['phpgw_info']['server']['max_access_log_age'] * 24 * 60 * 60);
22        else
23                $max_age = time() - (30 * 24 * 60 * 60);
24
25        $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_access_log WHERE li < $max_age");
26
27        $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_log *");
28
29        $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_log_msg *");
30
31        exit;
32?>
Note: See TracBrowser for help on using the repository browser.