Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormattab <matthieu.aubry@gmail.com>2013-11-12 07:56:48 +0400
committermattab <matthieu.aubry@gmail.com>2013-11-12 07:56:48 +0400
commit589663177da01a064f16702738552f55f35df316 (patch)
tree322f022ef678c517709f817b529723840ed78d65 /core/ArchiveProcessor.php
parentff13cdf7d74cbe84b196827c4a351265f2d84f1e (diff)
Trying to generalize the ArchiveProcessor code
Diffstat (limited to 'core/ArchiveProcessor.php')
-rw-r--r--core/ArchiveProcessor.php15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index e1ad4f4753..060cd42c33 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -130,6 +130,17 @@ class ArchiveProcessor
$this->archiveWriter = $archiveWriter;
}
+ protected function getArchive()
+ {
+ if(empty($this->archive)) {
+ $subPeriods = $this->params->getPeriod()->getSubperiods();
+ $idSite = $this->params->getSite()->getId();
+ $this->archive = Archive::factory($this->params->getSegment(), $subPeriods, array($idSite));
+ }
+ return $this->archive;
+ }
+
+
public function setNumberOfVisits($visits, $visitsConverted)
{
$this->numberOfVisits = $visits;
@@ -246,7 +257,7 @@ class ArchiveProcessor
if (!is_array($columns)) {
$columns = array($columns);
}
- $data = $this->archive->getNumeric($columns);
+ $data = $this->getArchive()->getNumeric($columns);
$operationForColumn = $this->getOperationForColumns($columns, $operationToApply);
$results = $this->aggregateDataArray($data, $operationForColumn);
$results = $this->defaultColumnsToZero($columns, $results);
@@ -345,7 +356,7 @@ class ArchiveProcessor
$table->setMetadata(DataTable::COLUMN_AGGREGATION_OPS_METADATA_NAME, $columnAggregationOperations);
}
- $data = $this->archive->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
+`` $data = $this->getArchive()->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
if ($data instanceof DataTable\Map) {
// as $date => $tableToSum
foreach ($data->getDataTables() as $tableToSum) {