Example #1
0
 /** Extract values from ArchiveProcessing */
 private function extractArchiveProcessing(Piwik_ArchiveProcessing $archive)
 {
     $this->archiveProcessing = $archive;
     $this->idsite = intval($archive->idsite);
     $this->period = $archive->period;
     $this->startDate = $archive->getStartDatetimeUTC();
     $this->endDate = $archive->getEndDatetimeUTC();
 }
Example #2
0
 /** Extract values from ArchiveProcessing */
 private function extractArchiveProcessing(Piwik_ArchiveProcessing $archive)
 {
     $this->archiveProcessing = $archive;
     $this->idsite = intval($archive->idsite);
     $this->site = Piwik_SitesManager_API::getInstance()->getSiteFromId($this->idsite);
     $this->period = $archive->period;
     $this->startDate = $archive->getStartDatetimeUTC();
     $this->endDate = $archive->getEndDatetimeUTC();
 }
Example #3
0
 /**
  * @param $select
  * @param $from
  * @param $where
  * @param $orderBy
  * @param $groupBy
  * @param $sprintfField
  * @param Piwik_ArchiveProcessing $archiveProcessing
  * @param Piwik_RankingQuery|false $rankingQuery
  * @return int
  */
 protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $sprintfField, $archiveProcessing, $rankingQuery = false)
 {
     // idaction field needs to be set in select clause before calling getSelectQuery().
     // if a complex segmentation join is needed, the field needs to be propagated
     // to the outer select. therefore, $segment needs to know about it.
     $select = sprintf($select, $sprintfField);
     $bind = array();
     // get query with segmentation
     $query = $archiveProcessing->getSegment()->getSelectQuery($select, $from, $where, $bind, $orderBy, $groupBy);
     // extend bindings
     $bind = array_merge(array($archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite), $query['bind']);
     // replace the rest of the %s
     $querySql = str_replace("%s", $sprintfField, $query['sql']);
     // apply ranking query
     if ($rankingQuery) {
         $querySql = $rankingQuery->generateQuery($querySql);
     }
     //      echo '<pre>';var_dump($querySql);
     //      var_dump($bind);
     // get result
     $resultSet = $archiveProcessing->db->query($querySql, $bind);
     $modified = Piwik_Actions_ArchivingHelper::updateActionsTableWithRowQuery($resultSet, $sprintfField, $this->actionsTablesByType);
     return $modified;
 }
Example #4
0
 /**
  * @param $select
  * @param $from
  * @param $where
  * @param $orderBy
  * @param $groupBy
  * @param $sprintfField
  * @param Piwik_ArchiveProcessing $archiveProcessing
  * @return int
  */
 protected function archiveDayQueryProcess($select, $from, $where, $orderBy, $groupBy, $sprintfField, $archiveProcessing)
 {
     // idaction field needs to be set in select clause before calling getSelectQuery().
     // if a complex segmentation join is needed, the field needs to be propagated
     // to the outer select. therefore, $segment needs to know about it.
     $select = sprintf($select, $sprintfField);
     // get query with segmentation
     $bind = array();
     $orderBy = false;
     $query = $archiveProcessing->getSegment()->getSelectQuery($select, $from, $where, $bind, $orderBy, $groupBy);
     // replace the rest of the %s
     $querySql = str_replace("%s", $sprintfField, $query['sql']);
     // extend bindings
     $bind = array_merge(array($archiveProcessing->getStartDatetimeUTC(), $archiveProcessing->getEndDatetimeUTC(), $archiveProcessing->idsite), $query['bind']);
     // get result
     $resultSet = $archiveProcessing->db->query($querySql, $bind);
     $modified = $this->updateActionsTableWithRowQuery($resultSet, $sprintfField);
     return $modified;
 }