Definition at line 6 of file LogCleaner.php.
◆ __construct()
sspmod_statistics_LogCleaner::__construct |
( |
|
$inputfile = null | ) |
|
Constructor.
Definition at line 17 of file LogCleaner.php.
References $inputfile, and SimpleSAML_Configuration\getConfig().
21 $this->statdir = $this->statconfig->getValue(
'statdir');
22 $this->inputfile = $this->statconfig->getValue(
'inputfile');
23 $this->statrules = $this->statconfig->getValue(
'statrules');
24 $this->offset = $this->statconfig->getValue(
'offset', 0);
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
◆ clean()
sspmod_statistics_LogCleaner::clean |
( |
|
$debug = false | ) |
|
Definition at line 38 of file LogCleaner.php.
References $action, $debug, $file, $i, $results, $sc, $todelete, array, date, and exit.
39 if (!is_dir($this->statdir)) {
40 throw new Exception(
'Statistics module: output dir do not exists [' . $this->statdir .
']');
43 if (!file_exists($this->inputfile)) {
44 throw new Exception(
'Statistics module: input file do not exists [' . $this->inputfile .
']');
47 $file = fopen($this->inputfile,
'r');
50 $this->statconfig->getValue(
'datestart', 0), $this->statconfig->getValue(
'datelength', 15), $this->statconfig->getValue(
'offsetspan', 44)
55 $sessioncounter =
array();
59 while (!feof(
$file)) {
60 $logline = fgets(
$file, 4096);
63 if (!preg_match(
'/STAT/', $logline)) {
69 $epoch = $logparser->parseEpoch($logline);
70 $content = $logparser->parseContent($logline);
73 if ((
$i % 10000) == 0) {
74 echo(
"Read line " .
$i .
"\n");
77 $trackid = $content[4];
79 if (!isset($sessioncounter[$trackid])) {
80 $sessioncounter[$trackid] = 0;
82 $sessioncounter[$trackid]++;
85 echo(
"----------------------------------------\n");
86 echo(
'Log line: ' . $logline .
"\n");
87 echo(
'Date parse [' . substr($logline, 0, $this->statconfig->getValue(
'datelength', 15)) .
'] to [' .
date(DATE_RFC822, $epoch) .
']' .
"\n");
88 echo htmlentities(print_r($content,
true));
96 foreach ($sessioncounter as $trackid =>
$sc) {
97 if (!isset($histogram[
$sc])) {
105 foreach ($sessioncounter as $trackid =>
$sc) {
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
◆ dumpConfig()
sspmod_statistics_LogCleaner::dumpConfig |
( |
| ) |
|
Definition at line 31 of file LogCleaner.php.
33 echo
'Statistics directory : ' . $this->statdir .
"\n";
34 echo
'Input file : ' . $this->inputfile .
"\n";
35 echo
'Offset : ' . $this->offset .
"\n";
◆ store()
sspmod_statistics_LogCleaner::store |
( |
|
$todelete, |
|
|
|
$outputfile |
|
) |
| |
Definition at line 114 of file LogCleaner.php.
References $action, $file, $i, $todelete, and sspmod_statistics_LogParser\parseContent().
116 echo
"Preparing to delete [" .count(
$todelete) .
"] trackids\n";
118 if (!is_dir($this->statdir)) {
119 throw new Exception(
'Statistics module: output dir do not exists [' . $this->statdir .
']');
122 if (!file_exists($this->inputfile)) {
123 throw new Exception(
'Statistics module: input file do not exists [' . $this->inputfile .
']');
126 $file = fopen($this->inputfile,
'r');
129 if (file_exists($outputfile)) {
133 $outfile = fopen($outputfile,
'x');
136 $this->statconfig->getValue(
'datestart', 0), $this->statconfig->getValue(
'datelength', 15), $this->statconfig->getValue(
'offsetspan', 44)
141 while (!feof(
$file)) {
142 $logline = fgets(
$file, 4096);
145 if (!preg_match(
'/STAT/', $logline)) {
153 if (($i % 10000) == 0) {
154 echo(
"Read line " . $i .
"\n");
157 $trackid = $content[4];
158 if (in_array($trackid,
$todelete,
true)) {
162 fputs($outfile, $logline);
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
◆ $inputfile
sspmod_statistics_LogCleaner::$inputfile |
|
private |
◆ $offset
sspmod_statistics_LogCleaner::$offset |
|
private |
◆ $statconfig
sspmod_statistics_LogCleaner::$statconfig |
|
private |
◆ $statdir
sspmod_statistics_LogCleaner::$statdir |
|
private |
◆ $statrules
sspmod_statistics_LogCleaner::$statrules |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/statistics/lib/LogCleaner.php