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:
authordiosmosis <benaka@piwik.pro>2015-04-27 00:59:50 +0300
committerdiosmosis <benaka@piwik.pro>2015-04-27 00:59:50 +0300
commitdb4874776aa839bc8ed1f70bcbd7712acc741746 (patch)
tree1b374298563c2f2a31228f4ffc5d35b23eb29fad /core/Archive.php
parent1760412a370823f96eeed21d730acf8f4038c843 (diff)
parentad93a77498cb03ae8f4c52c292d3b584f67c458e (diff)
Merge branch 'master' into config_step_2
Conflicts: core/Console.php piwik.php
Diffstat (limited to 'core/Archive.php')
-rw-r--r--core/Archive.php32
1 files changed, 24 insertions, 8 deletions
diff --git a/core/Archive.php b/core/Archive.php
index 161afb33ba..257aa5315e 100644
--- a/core/Archive.php
+++ b/core/Archive.php
@@ -357,6 +357,24 @@ class Archive
}
/**
+ * Similar to {@link getDataTableFromNumeric()} but merges all children on the created DataTable.
+ *
+ * This is the same as doing `$this->getDataTableFromNumeric()->mergeChildren()` but this way it is much faster.
+ *
+ * @return DataTable|DataTable\Map
+ *
+ * @internal Currently only used by MultiSites.getAll plugin. Feel free to remove internal tag if needed somewhere
+ * else. If no longer needed by MultiSites.getAll please remove this method. If you need this to work in
+ * a bit different way feel free to refactor as always.
+ */
+ public function getDataTableFromNumericAndMergeChildren($names)
+ {
+ $data = $this->get($names, 'numeric');
+ $resultIndexes = $this->getResultIndices();
+ return $data->getMergedDataTable($resultIndexes);
+ }
+
+ /**
* Queries and returns one or more reports as DataTable instances.
*
* This method will query blob data that is a serialized array of of {@link DataTable\Row}'s and
@@ -616,21 +634,19 @@ class Archive
$archiveData = ArchiveSelector::getArchiveData($archiveIds, $archiveNames, $archiveDataType, $idSubtable);
+ $isNumeric = $archiveDataType == 'numeric';
+
foreach ($archiveData as $row) {
// values are grouped by idsite (site ID), date1-date2 (date range), then name (field name)
- $idSite = $row['idsite'];
- $periodStr = $row['date1'] . "," . $row['date2'];
+ $periodStr = $row['date1'] . ',' . $row['date2'];
- if ($archiveDataType == 'numeric') {
+ if ($isNumeric) {
$row['value'] = $this->formatNumericValue($row['value']);
} else {
- $result->addMetadata($idSite, $periodStr, 'ts_archived', $row['ts_archived']);
+ $result->addMetadata($row['idsite'], $periodStr, 'ts_archived', $row['ts_archived']);
}
- $resultRow = & $result->get($idSite, $periodStr);
-
- // one blob per datatable or subtable
- $resultRow[$row['name']] = $row['value'];
+ $result->set($row['idsite'], $periodStr, $row['name'], $row['value']);
}
return $result;