Exemplo n.º 1
0
 /**
  * Records the daily stats (numeric or datatable blob) into the archive tables.
  *
  * @param Piwik_ArchiveProcessing $archiveProcessing
  * @return void
  */
 protected function archiveDayRecordInDatabase($archiveProcessing)
 {
     $numericRecords = array('Referers_distinctSearchEngines' => count($this->interestBySearchEngineAndKeyword), 'Referers_distinctKeywords' => count($this->interestByKeywordAndSearchEngine), 'Referers_distinctCampaigns' => count($this->interestByCampaign), 'Referers_distinctWebsites' => count($this->interestByWebsite), 'Referers_distinctWebsitesUrls' => count($this->distinctUrls));
     foreach ($numericRecords as $name => $value) {
         $archiveProcessing->insertNumericRecord($name, $value);
     }
     $dataTable = $archiveProcessing->getDataTableSerialized($this->interestByType);
     $archiveProcessing->insertBlobRecord('Referers_type', $dataTable);
     destroy($dataTable);
     $blobRecords = array('Referers_keywordBySearchEngine' => $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->interestBySearchEngineAndKeyword, $this->interestBySearchEngine), 'Referers_searchEngineByKeyword' => $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->interestByKeywordAndSearchEngine, $this->interestByKeyword), 'Referers_keywordByCampaign' => $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->interestByCampaignAndKeyword, $this->interestByCampaign), 'Referers_urlByWebsite' => $archiveProcessing->getDataTableWithSubtablesFromArraysIndexedByLabel($this->interestByWebsiteAndUrl, $this->interestByWebsite));
     foreach ($blobRecords as $recordName => $table) {
         $blob = $table->getSerialized($this->maximumRowsInDataTableLevelZero, $this->maximumRowsInSubDataTable, $this->columnToSortByBeforeTruncation);
         $archiveProcessing->insertBlobRecord($recordName, $blob);
         destroy($table);
     }
 }