47 {
48 if (!is_dir($this->statdir)) {
49 throw new Exception('Statistics module: output dir do not exists [' . $this->statdir . ']');
50 }
51
52 if (!file_exists($this->inputfile)) {
53 throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']');
54 }
55
56 $file = fopen($this->inputfile, 'r');
57
59 $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44)
60 );
61
62 $sessioncounter = array();
63
65
66 while (!feof($file)) {
67 $logline = fgets($file, 4096);
68
69
70 if (!preg_match('/STAT/', $logline)) {
71 continue;
72 }
74
75
76 $epoch = $logparser->parseEpoch($logline);
77 $content = $logparser->parseContent($logline);
78
79 if ((
$i % 10000) == 0) {
80 echo(
"Read line " .
$i .
"\n");
81 }
82
83 $trackid = $content[4];
84
85 if (!isset($sessioncounter[$trackid])) {
86 $sessioncounter[$trackid] = 0;
87 }
88 $sessioncounter[$trackid]++;
89
91 echo("----------------------------------------\n");
92 echo('Log line: ' . $logline . "\n");
93 echo('Date parse [' . substr($logline, 0, $this->statconfig->getValue('datelength', 15)) . '] to [' . date(DATE_RFC822, $epoch) . ']' . "\n");
94 echo htmlentities(print_r($content, true));
97 }
98 }
99 }
100
101 $histogram = array();
102 foreach ($sessioncounter as $trackid =>
$sc) {
103 if (!isset($histogram[
$sc])) {
105 }
107 }
108 ksort($histogram);
109
111 foreach ($sessioncounter as $trackid =>
$sc) {
114 }
115 }
116
118 }