30, 'remove' => 90 ); # DAYs $latest = strtotime('-' . $w['each'] . ' days'); $previous = pwg_get_session_var('history_check', $latest); if ( $previous <= $latest ) { $q = ' DELETE FROM ' . HISTORY_TABLE . ' WHERE date < DATE_SUB(NOW(), INTERVAL ' . $w['remove'] . ' DAY) AND summarized = "true";'; $r = pwg_query($q); if($r) { if (defined('DB_ENGINE') and DB_ENGINE == 'PostgreSQL') $q = 'VACUUM FULL '.HISTORY_TABLE; else $q = 'OPTIMIZE TABLE '.HISTORY_TABLE; $r=pwg_query($q); } pwg_set_session_var('history_check', strtotime("now")); return $r; } return false; } } ?>