72 {
74
75 if (!is_dir($this->statdir)) {
76 throw new Exception('Statistics module: output dir do not exists [' . $this->statdir . ']');
77 }
78
79 if (!file_exists($this->inputfile)) {
80 throw new Exception('Statistics module: input file do not exists [' . $this->inputfile . ']');
81 }
82
83 $file = fopen($this->inputfile,
'r');
84
85 if (
$file ===
false) {
86 throw new Exception('Statistics module: unable to open file [' . $this->inputfile . ']');
87 }
88
90 $this->statconfig->getValue('datestart', 0), $this->statconfig->getValue('datelength', 15), $this->statconfig->getValue('offsetspan', 44)
91 );
92 $datehandler = array(
95 );
96
97 $notBefore = 0;
98 $lastRead = 0;
99 $lastlinehash = '-';
100
101 if (isset($this->metadata)) {
102 $notBefore = $this->metadata['notBefore'];
103 $lastlinehash = $this->metadata['lastlinehash'];
104 }
105
106 $lastlogline = 'sdfsdf';
107 $lastlineflip = false;
109
111
112 while (!feof(
$file)) {
113 $logline = fgets(
$file, 4096);
114
115
116 if (!preg_match('/STAT/', $logline)) {
117 continue;
118 }
119
121 $lastlogline = $logline;
122
123
124 $epoch = $logparser->parseEpoch($logline);
125 $content = $logparser->parseContent($logline);
127
128 if ($this->fromcmdline && (
$i % 10000) == 0) {
129 echo(
"Read line " .
$i .
"\n");
130 }
131
133 echo("----------------------------------------\n");
134 echo('Log line: ' . $logline . "\n");
135 echo(
'Date parse [' . substr($logline, 0, $this->statconfig->getValue(
'datelength', 15)) .
'] to [' .
date(DATE_RFC822, $epoch) .
']' .
"\n");
136 echo htmlentities(print_r($content, true));
139 }
140 }
141
142 if ($epoch > $lastRead) {
143 $lastRead = $epoch;
144 }
145
146 if ($epoch === $notBefore) {
147 if (!$lastlineflip) {
148 if (sha1($logline) === $lastlinehash) {
149 $lastlineflip = true;
150 }
151 continue;
152 }
153 }
154
155 if ($epoch < $notBefore) {
156 continue;
157 }
158
159
160 foreach ($this->statrules as $rulename =>
$rule) {
162
163 if (array_key_exists(
'type',
$rule)) {
165 }
166
167 if (
$type !==
'aggregate') {
168 continue;
169 }
170
171 foreach ($this->timeres AS $tres => $tresconfig ) {
172 $dh = 'default';
173 if (isset($tresconfig['customDateHandler'])) {
174 $dh = $tresconfig['customDateHandler'];
175 }
176
177 $timeslot = $datehandler['default']->toSlot($epoch, $tresconfig['slot']);
178 $fileslot = $datehandler[$dh]->toSlot($epoch, $tresconfig[
'fileslot']);
179
181 continue;
182 }
183
185
188 }
191 }
192
195 }
196 }
197 }
198 $this->metadata['notBefore'] = $lastRead;
199 $this->metadata['lastline'] = $lastlogline;
200 $this->metadata['lastlinehash'] = sha1($lastlogline);
202 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
static getDifCol($content, $colrule)
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file