From 421232de9bd9a132f1ef25edf30f60a944d2ec1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=85kre=20Solberg?= <andreas.solberg@uninett.no> Date: Mon, 9 Mar 2009 12:57:43 +0000 Subject: [PATCH] Support input file parameter to logcleaner git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@1393 44740490-163a-0410-bde0-09ae8108e29a --- modules/statistics/bin/logcleaner.php | 7 ++++++- modules/statistics/lib/LogCleaner.php | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/statistics/bin/logcleaner.php b/modules/statistics/bin/logcleaner.php index 9111d92cc..ffa1ecded 100755 --- a/modules/statistics/bin/logcleaner.php +++ b/modules/statistics/bin/logcleaner.php @@ -17,6 +17,7 @@ $progName = array_shift($argv); $debug = FALSE; $dryrun = FALSE; $output = '/tmp/simplesamlphp-new.log'; +$infile = NULL; foreach($argv as $a) { if(strlen($a) === 0) continue; @@ -45,6 +46,9 @@ foreach($argv as $a) { case '--dry-run': $dryrun = TRUE; break; + case '--infile': + $infile = $v; + break; case '--outfile': $output = $v; break; @@ -55,7 +59,7 @@ foreach($argv as $a) { } } -$cleaner = new sspmod_statistics_LogCleaner(); +$cleaner = new sspmod_statistics_LogCleaner($infile); $cleaner->dumpConfig(); $todelete = $cleaner->clean($debug); @@ -80,6 +84,7 @@ The script deletes log lines related to sessions that produce more than 200 line Options: -d, --debug Used when configuring the log file syntax. See doc. --dry-run Aggregate but do not store the results. + --infile File input. --outfile File to output the results. '); diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index fe9250f9d..5d086ba75 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -15,7 +15,7 @@ class sspmod_statistics_LogCleaner { /** * Constructor */ - public function __construct() { + public function __construct($inputfile = NULL) { $this->statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); @@ -23,6 +23,8 @@ class sspmod_statistics_LogCleaner { $this->inputfile = $this->statconfig->getValue('inputfile'); $this->statrules = $this->statconfig->getValue('statrules'); $this->offset = $this->statconfig->getValue('offset', 0); + + if (isset($inputfile)) $this->inputfile = $inputfile; } public function dumpConfig() { -- GitLab