This repository has been archived by the owner on Jul 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathArchiver.php
55 lines (44 loc) · 1.65 KB
/
Archiver.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
namespace Piwik\Plugins\PlatformsReport;
use Piwik\Common;
use Piwik\Metrics;
class Archiver extends \Piwik\Plugin\Archiver
{
const PLATFORMS_RECORD_NAME = 'PlatformsReport_Platforms';
public function aggregateDayReport()
{
$this->aggregateVisitsByPlatforms();
}
public function aggregateMultipleReports()
{
$dataTableRecords = array(self::PLATFORMS_RECORD_NAME);
$columnsAggregationOperation = null;
$this->getProcessor()->aggregateDataTableRecords(
$dataTableRecords,
$this->maximumRows,
$maximumRowsInSubDataTable = null,
$columnToSortByBeforeTruncation = null,
$columnsAggregationOperation,
$columnsToRenameAfterAggregation = null,
$countRowsRecursive = array());
}
private function aggregateVisitsByPlatforms()
{
$platformDimensionSql = 'CONCAT(log_visit.config_device_type, ";", log_visit.config_os, ";", '
. 'log_visit.config_os_version, ";", log_visit.config_browser_name, ";", '
. 'log_visit.config_browser_version)';
$dataArray = $this->getLogAggregator()->getMetricsFromVisitByDimension($platformDimensionSql);
$table = $dataArray->asDataTable();
unset($dataArray);
$report = $table->getSerialized($this->maximumRows, null, Metrics::INDEX_NB_VISITS);
$this->getProcessor()->insertBlobRecord(self::PLATFORMS_RECORD_NAME, $report);
Common::destroy($table);
unset($table);
}
}