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-05 13:52:56 +0400
committermattab <matthieu.aubry@gmail.com>2013-11-05 13:52:56 +0400
commit74b81758637e420732a398813baed3c17cb2ce40 (patch)
treed9bf3b34fdf5163aaea9f7e9ee9d3450fec25118 /core/ArchiveProcessor.php
parenta73f56303d5ee4026fd1a810ce325b0501861061 (diff)
Refs #4278 Simplifying ArchiveProcessor
Diffstat (limited to 'core/ArchiveProcessor.php')
-rw-r--r--core/ArchiveProcessor.php46
1 files changed, 6 insertions, 40 deletions
diff --git a/core/ArchiveProcessor.php b/core/ArchiveProcessor.php
index 9a02d8dd49..e133ac7bbb 100644
--- a/core/ArchiveProcessor.php
+++ b/core/ArchiveProcessor.php
@@ -138,14 +138,6 @@ class ArchiveProcessor
}
/**
- * @return ArchiveWriter
- */
- public function getArchiveWriter()
- {
- return $this->archiveWriter;
- }
-
- /**
* Caches multiple numeric records in the archive for this processor's site, period
* and segment.
*
@@ -176,7 +168,7 @@ class ArchiveProcessor
public function insertNumericRecord($name, $value)
{
$value = round($value, 2);
- $this->getArchiveWriter()->insertRecord($name, $value);
+ $this->archiveWriter->insertRecord($name, $value);
}
public function getNumberOfVisits()
@@ -203,35 +195,7 @@ class ArchiveProcessor
*/
public function insertBlobRecord($name, $values)
{
- if (is_array($values)) {
- $clean = array();
- foreach ($values as $id => $value) {
- // for the parent Table we keep the name
- // for example for the Table of searchEngines we keep the name 'referrer_search_engine'
- // but for the child table of 'Google' which has the ID = 9 the name would be 'referrer_search_engine_9'
- $newName = $name;
- if ($id != 0) {
- //FIXMEA: refactor
- $newName = $name . '_' . $id;
- }
-
- $value = $this->compress($value);
- $clean[] = array($newName, $value);
- }
- $this->getArchiveWriter()->insertBulkRecords($clean);
- return;
- }
-
- $values = $this->compress($values);
- $this->getArchiveWriter()->insertRecord($name, $values);
- }
-
- protected function compress($data)
- {
- if (Db::get()->hasBlobDataType()) {
- return gzcompress($data);
- }
- return $data;
+ $this->archiveWriter->insertBlobRecord($name, $values);
}
/**
@@ -325,7 +289,7 @@ class ArchiveProcessor
$this->enrichWithUniqueVisitorsMetric($results);
foreach ($results as $name => $value) {
- $this->getArchiveWriter()->insertRecord($name, $value);
+ $this->archiveWriter->insertRecord($name, $value);
}
// if asked for only one field to sum
@@ -355,7 +319,8 @@ class ArchiveProcessor
$data = $this->archive->getDataTableExpanded($name, $idSubTable = null, $depth = null, $addMetadataSubtableId = false);
if ($data instanceof DataTable\Map) {
- foreach ($data->getDataTables() as $date => $tableToSum) {
+ // as $date => $tableToSum
+ foreach ($data->getDataTables() as $tableToSum) {
$table->addDataTable($tableToSum);
}
} else {
@@ -479,5 +444,6 @@ class ArchiveProcessor
$data = $query->fetch();
return $data[Metrics::INDEX_NB_UNIQ_VISITORS];
}
+
}