32 protected $rotation_index;
33 protected $total_size;
34 protected $blank_query;
48 $this->rotation_index = $rotation_index;
50 $this->total_size = $this->
getLogSize($this->log, $this->rotation_index);
52 if (empty($this->total_size)) {
53 $this->total_size = 0;
56 $fm = $GLOBALS[
'SQ_SYSTEM']->am->getSystemAsset(
'funnelback_manager');
57 $this->blank_query = $fm->getNullQueryKeyword();
73 $suffix = ((!is_null($rotation_index) && is_numeric($rotation_index)) ?
'.'.$rotation_index :
'');
77 if (file_exists($file)) {
78 $size = sprintf(
'%u', filesize($file));
96 if ($this->offset < $this->total_size) {
97 $suffix = ((!is_null($this->rotation_index) && is_numeric($this->rotation_index)) ?
'.'.$this->rotation_index :
'');
98 $logfile = $this->log.$suffix;
99 $line = $this->
_getLogLine($logfile, $this->offset);
100 $line_offset = array_get_index($line,
'offset', FALSE);
102 if ($line_offset != FALSE && $line_offset >= 0) {
103 $this->offset = $line_offset;
106 $line[
'line'] = $this->
_decodeLine(array_get_index($line,
'line', FALSE));
126 'current' => $this->offset,
127 'total' => $this->total_size,
146 if (empty($file))
return FALSE;
148 $file_contents = Array();
150 if (file_exists($file) && $handle = fopen($file,
'r')) {
151 if (fseek($handle, $offset) >= 0 && !feof($handle)) {
152 $line = fgets($handle);
154 $offset = ftell($handle);
156 'line' => trim($line),
164 trigger_localised_error(
'CORE0018', E_USER_ERROR, $file);
188 if ($line === FALSE || !is_string($line) || strpos($line,
',') === FALSE) {
193 $line_data = explode(
',', $line);
195 $decoded[
'date'] = strtotime($line_data[0]);
196 $decoded[
'ip'] = $line_data[1];
197 $decoded[
'query'] = str_replace($this->blank_query,
'', $line_data[2]);
198 $decoded[
'include'] = $line_data[3];
199 $decoded[
'exclude'] = $line_data[4];
200 $decoded[
'start'] = $line_data[5];
201 $decoded[
'ranks'] = $line_data[6];
202 $decoded[
'codes'] = $line_data[7];
203 $decoded[
'full_matches'] = $line_data[8];
204 $decoded[
'partial_matches'] = $line_data[9];
205 $decoded[
'elapsed_time'] = $line_data[10];
206 $decoded[
'profile'] = $line_data[11];