Пример #1
0
 public function filter(\Riimu\LogParser\LogRow $row)
 {
     if ($this->group) {
         $filter = in_array($row->getField($this->name), $this->values);
     } else {
         $filter = $row->getField($this->name) === $this->values;
     }
     return $this->reverse ? !$filter : $filter;
 }
Пример #2
0
 public function processRow(\Riimu\LogParser\LogRow $row)
 {
     $url = $row->getReferrer();
     if ($url === null) {
         $this->noReferrer++;
         return true;
     }
     $agent = $row->getBrowser();
     if ($agent === null || $agent->Crawler) {
         $name = $agent === null ? 'Unknown' : $agent->Browser;
         $this->increment($this->crawlerReferrers[$name][$url]);
         return true;
     }
     if (!isset($this->referrers[$url])) {
         $info = $row->getUrlInfo();
         $referrer = $row->getReferrerInfo();
         if (!$info) {
             $this->increment($this->invalidReferrers[$url]);
             return true;
         } elseif ($referrer->getType() === 'search') {
             $this->increment($this->searchReferrers[$url]);
             return true;
         } elseif ($referrer->getType() === 'spam') {
             $this->increment($this->spamReferrers[$url]);
             return true;
         }
         $domain = $info->getHostname();
         if (in_array($domain, $this->internalDomains)) {
             $this->increment($this->internalReferrers[$url]);
             return true;
         }
         $this->referrers[$url] = ['domain' => $domain, 'days' => [], 'targets' => []];
         if (!isset($this->domains[$domain])) {
             $this->domains[$domain] = ['days' => [], 'referrers' => []];
         }
         $this->domains[$domain]['referrers'][] = $url;
     } else {
         $domain = $this->referrers[$url]['domain'];
     }
     $path = $row->getPath();
     if (!isset($this->targets[$path])) {
         $this->targets[$path] = ['days' => [], 'referrers' => []];
     }
     if (!in_array($path, $this->referrers[$url]['targets'])) {
         $this->referrers[$url]['targets'][] = $path;
     }
     if (!in_array($url, $this->targets[$path]['referrers'])) {
         $this->targets[$path]['referrers'][] = $url;
     }
     $day = $row->getDay();
     $this->increment($this->referrers[$url]['days'][$day]);
     $this->increment($this->domains[$domain]['days'][$day]);
     $this->increment($this->targets[$path]['days'][$day]);
     return true;
 }
Пример #3
0
 public function processRow(\Riimu\LogParser\LogRow $row)
 {
     $agent = $row->getUserAgent();
     if ($agent === null) {
         $this->noUserAgent++;
         return true;
     }
     $browser = $row->getBrowser();
     if ($browser === null) {
         $this->increment($this->invalidAgents[$agent]);
         return true;
     }
     $day = $row->getDay();
     if ($browser->Crawler) {
         $this->increment($this->crawlers[$browser->Browser][$day]);
     } else {
         $this->increment($this->browsers[$browser->Browser][$day]);
         $this->increment($this->versions[$browser->Browser][$browser->Version][$day]);
     }
     return true;
 }
Пример #4
0
 private function isPageView(\Riimu\LogParser\LogRow $row)
 {
     if ($row->getCode() != '200' && $row->getCode() != '304') {
         return false;
     }
     $path = $row->getPath();
     if (!isset($this->paths[$path])) {
         $this->paths[$path] = true;
         foreach ($this->patterns as $pattern) {
             if (preg_match($pattern, $path)) {
                 $this->paths[$path] = false;
                 break;
             }
         }
     }
     return $this->paths[$path];
 }