diff options
author | Thomas Steur <tsteur@users.noreply.github.com> | 2018-07-17 23:34:35 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-17 23:34:35 +0300 |
commit | 74334d8d0908910ed3cc4a9a918436d9f9ccc3f6 (patch) | |
tree | bada789873ec90c243f2d04d21d1e24341948a41 /plugins | |
parent | 6a505441d26513aef2c1937d9be7ecb632eaf020 (diff) |
Refactor archivers to support multiple idsites (#13168)
* refactor archivers to support multiple idsites
* added a test to ensure multiple sites work
* add comment
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Actions/Archiver.php | 24 | ||||
-rw-r--r-- | plugins/Contents/Archiver.php | 12 | ||||
-rw-r--r-- | plugins/Events/Archiver.php | 6 |
3 files changed, 14 insertions, 28 deletions
diff --git a/plugins/Actions/Archiver.php b/plugins/Actions/Archiver.php index af84c385a6..f49e4e15c5 100644 --- a/plugins/Actions/Archiver.php +++ b/plugins/Actions/Archiver.php @@ -161,10 +161,8 @@ class Archiver extends \Piwik\Plugin\Archiver ) ); - $where = "log_link_visit_action.server_time >= ? - AND log_link_visit_action.server_time <= ? - AND log_link_visit_action.idsite = ? - AND log_link_visit_action.%s IS NOT NULL" + $where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.%s IS NOT NULL" . $this->getWhereClauseActionIsNotEvent(); $groupBy = "log_link_visit_action.%s"; @@ -285,10 +283,8 @@ class Archiver extends \Piwik\Plugin\Archiver sum(log_visit.visit_total_time) as `" . PiwikMetrics::INDEX_PAGE_ENTRY_SUM_VISIT_LENGTH . "`, sum(case log_visit.visit_total_actions when 1 then 1 when 0 then 1 else 0 end) as `" . PiwikMetrics::INDEX_PAGE_ENTRY_BOUNCE_COUNT . "`"; - $where = "log_visit.visit_last_action_time >= ? - AND log_visit.visit_last_action_time <= ? - AND log_visit.idsite = ? - AND log_visit.%s > 0"; + $where = $this->getLogAggregator()->getWhereStatement('log_visit', 'visit_last_action_time'); + $where .= " AND log_visit.%s > 0"; $groupBy = "log_visit.%s"; @@ -330,10 +326,8 @@ class Archiver extends \Piwik\Plugin\Archiver count(distinct log_visit.idvisitor) as `" . PiwikMetrics::INDEX_PAGE_EXIT_NB_UNIQ_VISITORS . "`, count(*) as `" . PiwikMetrics::INDEX_PAGE_EXIT_NB_VISITS . "`"; - $where = "log_visit.visit_last_action_time >= ? - AND log_visit.visit_last_action_time <= ? - AND log_visit.idsite = ? - AND log_visit.%s > 0"; + $where = $this->getLogAggregator()->getWhereStatement('log_visit', 'visit_last_action_time'); + $where .= " AND log_visit.%s > 0"; $groupBy = "log_visit.%s"; @@ -374,10 +368,8 @@ class Archiver extends \Piwik\Plugin\Archiver $select = "log_link_visit_action.%s as idaction, $extraSelects sum(log_link_visit_action.time_spent_ref_action) as `" . PiwikMetrics::INDEX_PAGE_SUM_TIME_SPENT . "`"; - $where = "log_link_visit_action.server_time >= ? - AND log_link_visit_action.server_time <= ? - AND log_link_visit_action.idsite = ? - AND log_link_visit_action.time_spent_ref_action > 0 + $where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.time_spent_ref_action > 0 AND log_link_visit_action.%s > 0" . $this->getWhereClauseActionIsNotEvent(); diff --git a/plugins/Contents/Archiver.php b/plugins/Contents/Archiver.php index ea922195b6..9a642e29bd 100644 --- a/plugins/Contents/Archiver.php +++ b/plugins/Contents/Archiver.php @@ -103,10 +103,8 @@ class Archiver extends \Piwik\Plugin\Archiver ) ); - $where = "log_link_visit_action.server_time >= ? - AND log_link_visit_action.server_time <= ? - AND log_link_visit_action.idsite = ? - AND log_link_visit_action.idaction_content_name IS NOT NULL + $where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.idaction_content_name IS NOT NULL AND log_link_visit_action.idaction_content_interaction IS NULL"; $groupBy = "log_link_visit_action.idaction_content_piece, @@ -161,10 +159,8 @@ class Archiver extends \Piwik\Plugin\Archiver ) ); - $where = "log_link_visit_action.server_time >= ? - AND log_link_visit_action.server_time <= ? - AND log_link_visit_action.idsite = ? - AND log_link_visit_action.idaction_content_name IS NOT NULL + $where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.idaction_content_name IS NOT NULL AND log_link_visit_action.idaction_content_interaction IS NOT NULL"; $groupBy = "log_action_content_piece.idaction, diff --git a/plugins/Events/Archiver.php b/plugins/Events/Archiver.php index 69531a5c81..0146fa738f 100644 --- a/plugins/Events/Archiver.php +++ b/plugins/Events/Archiver.php @@ -167,10 +167,8 @@ class Archiver extends \Piwik\Plugin\Archiver ) ); - $where = "log_link_visit_action.server_time >= ? - AND log_link_visit_action.server_time <= ? - AND log_link_visit_action.idsite = ? - AND log_link_visit_action.idaction_event_category IS NOT NULL"; + $where = $this->getLogAggregator()->getWhereStatement('log_link_visit_action', 'server_time'); + $where .= " AND log_link_visit_action.idaction_event_category IS NOT NULL"; $groupBy = "log_link_visit_action.idaction_event_category, log_link_visit_action.idaction_event_action, |