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);
33 echo
'Statistics directory : ' . $this->statdir .
"\n";
34 echo
'Input file : ' . $this->inputfile .
"\n";
35 echo
'Offset : ' . $this->offset .
"\n";
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) {
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);
store($todelete, $outputfile)
__construct($inputfile=null)
Constructor.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
Create styles array
The data for the language used.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file