aggregateByConfiguration(); $this->aggregateByOs(); $this->aggregateByBrowser(); $this->aggregateByResolutionAndScreenType(); $this->aggregateByPlugin(); $this->aggregateByLanguage(); } /** * Period archiving: simply sums up daily archives */ public function aggregateMultipleReports() { $dataTableRecords = array( self::CONFIGURATION_RECORD_NAME, self::OS_RECORD_NAME, self::BROWSER_RECORD_NAME, self::BROWSER_TYPE_RECORD_NAME, self::RESOLUTION_RECORD_NAME, self::SCREEN_TYPE_RECORD_NAME, self::PLUGIN_RECORD_NAME, self::LANGUAGE_RECORD_NAME, ); $this->getProcessor()->aggregateDataTableRecords($dataTableRecords, $this->maximumRows); } protected function aggregateByConfiguration() { $metrics = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::CONFIGURATION_DIMENSION)->asDataTable(); $this->insertTable(self::CONFIGURATION_RECORD_NAME, $metrics); } protected function aggregateByOs() { $metrics = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::OS_DIMENSION)->asDataTable(); $this->insertTable(self::OS_RECORD_NAME, $metrics); } protected function aggregateByBrowser() { $tableBrowser = $this->aggregateByBrowserVersion(); $this->aggregateByBrowserType($tableBrowser); } protected function aggregateByBrowserVersion() { $tableBrowser = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::BROWSER_VERSION_DIMENSION)->asDataTable(); $this->insertTable(self::BROWSER_RECORD_NAME, $tableBrowser); return $tableBrowser; } protected function aggregateByBrowserType(DataTable $tableBrowser) { $tableBrowser->filter('GroupBy', array('label', __NAMESPACE__ . '\getBrowserFamily')); $this->insertTable(self::BROWSER_TYPE_RECORD_NAME, $tableBrowser); } protected function aggregateByResolutionAndScreenType() { $resolutions = $this->aggregateByResolution(); $this->aggregateByScreenType($resolutions); } protected function aggregateByResolution() { $table = $this->getLogAggregator()->getMetricsFromVisitByDimension(self::RESOLUTION_DIMENSION)->asDataTable(); $table->filter('ColumnCallbackDeleteRow', array('label', function ($value) { return strlen($value) <= 5; })); $this->insertTable(self::RESOLUTION_RECORD_NAME, $table); return $table; } protected function aggregateByScreenType(DataTable $resolutions) { $resolutions->filter('GroupBy', array('label', __NAMESPACE__ . '\getScreenTypeFromResolution')); $this->insertTable(self::SCREEN_TYPE_RECORD_NAME, $resolutions); } protected function aggregateByPlugin() { $selects = array( "sum(case log_visit.config_pdf when 1 then 1 else 0 end) as pdf", "sum(case log_visit.config_flash when 1 then 1 else 0 end) as flash", "sum(case log_visit.config_java when 1 then 1 else 0 end) as java", "sum(case log_visit.config_director when 1 then 1 else 0 end) as director", "sum(case log_visit.config_quicktime when 1 then 1 else 0 end) as quicktime", "sum(case log_visit.config_realplayer when 1 then 1 else 0 end) as realplayer", "sum(case log_visit.config_windowsmedia when 1 then 1 else 0 end) as windowsmedia", "sum(case log_visit.config_gears when 1 then 1 else 0 end) as gears", "sum(case log_visit.config_silverlight when 1 then 1 else 0 end) as silverlight", "sum(case log_visit.config_cookie when 1 then 1 else 0 end) as cookie" ); $query = $this->getLogAggregator()->queryVisitsByDimension(array(), false, $selects, $metrics = array()); $data = $query->fetch(); $cleanRow = LogAggregator::makeArrayOneColumn($data, Metrics::INDEX_NB_VISITS); $table = DataTable::makeFromIndexedArray($cleanRow); $this->insertTable(self::PLUGIN_RECORD_NAME, $table); } protected function aggregateByLanguage() { $query = $this->getLogAggregator()->queryVisitsByDimension(array("label" => self::LANGUAGE_DIMENSION)); $languageCodes = array_keys(Common::getLanguagesList()); $metricsByLanguage = new DataArray(); while ($row = $query->fetch()) { $code = Common::extractLanguageCodeFromBrowserLanguage($row['label'], $languageCodes); $metricsByLanguage->sumMetricsVisits($code, $row); } $report = $metricsByLanguage->asDataTable(); $this->insertTable(self::LANGUAGE_RECORD_NAME, $report); } protected function insertTable($recordName, DataTable $table) { $report = $table->getSerialized($this->maximumRows, null, Metrics::INDEX_NB_VISITS); return $this->getProcessor()->insertBlobRecord($recordName, $report); } }