diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-29 10:25:52 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-29 10:25:52 +0000 |
commit | f09c351e7e56393236d58426e5f0acb30c5c8912 (patch) | |
tree | 6d12309483bbf2b122d3cfcfcde935a098585d78 /mod/logrotate | |
parent | 474144e6ba90c5cb5bb99ad03c81aba71ccfa8c1 (diff) | |
download | elgg-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 'mod/logrotate')
-rw-r--r-- | mod/logrotate/start.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/mod/logrotate/start.php b/mod/logrotate/start.php index f9a9a0449..349b5ad84 100644 --- a/mod/logrotate/start.php +++ b/mod/logrotate/start.php @@ -36,7 +36,20 @@ function logrotate_cron($hook, $entity_type, $returnvalue, $params) { $resulttext = elgg_echo("logrotate:logrotated"); - if (!archive_log()) + + $day = 86400; + + $offset = 0; + $period = get_plugin_setting('period','logrotate'); + switch ($period) + { + case 'weekly': $offset = $day * 7; break; + case 'yearly' : $offset = $day * 365; break; + case 'monthly' : // assume 28 days even if a month is longer. Won't cause data loss. + default: $offset = $day * 28;; + } + + if (!archive_log($offset)) $resulttext = elgg_echo("logrotate:lognotrotated"); return $returnvalue . $resulttext; |