aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-29 10:25:52 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-10-29 10:25:52 +0000
commitf09c351e7e56393236d58426e5f0acb30c5c8912 (patch)
tree6d12309483bbf2b122d3cfcfcde935a098585d78 /engine/lib
parent474144e6ba90c5cb5bb99ad03c81aba71ccfa8c1 (diff)
downloadelgg-f09c351e7e56393236d58426e5f0acb30c5c8912.tar.gz
elgg-f09c351e7e56393236d58426e5f0acb30c5c8912.tar.bz2
Logrotate and archive containing offset. Table still created as $now but containing < $now-period.
git-svn-id: https://code.elgg.org/elgg/trunk@2337 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/system_log.php9
1 files changed, 7 insertions, 2 deletions
diff --git a/engine/lib/system_log.php b/engine/lib/system_log.php
index 2c07d8489..c6a91364f 100644
--- a/engine/lib/system_log.php
+++ b/engine/lib/system_log.php
@@ -234,15 +234,20 @@
/**
* This function creates an archive copy of the system log.
+ *
+ * @param int $offset An offset in seconds from now to archive (useful for log rotation)
*/
- function archive_log()
+ function archive_log($offset = 0)
{
global $CONFIG;
+ $offset = (int)$offset;
$now = time(); // Take a snapshot of now
+
+ $ts = $now - $offset;
// create table
- if (!update_data("CREATE TABLE {$CONFIG->dbprefix}system_log_$now as SELECT * from {$CONFIG->dbprefix}system_log WHERE time_created<=$now"))
+ if (!update_data("CREATE TABLE {$CONFIG->dbprefix}system_log_$now as SELECT * from {$CONFIG->dbprefix}system_log WHERE time_created<=$ts"))
return false;
// alter table to engine