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:
Diffstat (limited to 'core/Archive/Array/IndexedByDate.php')
-rw-r--r--core/Archive/Array/IndexedByDate.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/core/Archive/Array/IndexedByDate.php b/core/Archive/Array/IndexedByDate.php
index 53a0369153..8629ef9672 100644
--- a/core/Archive/Array/IndexedByDate.php
+++ b/core/Archive/Array/IndexedByDate.php
@@ -25,7 +25,7 @@ class Piwik_Archive_Array_IndexedByDate extends Piwik_Archive_Array
*/
function __construct(Piwik_Site $oSite, $strPeriod, $strDate)
{
- $rangePeriod = new Piwik_Period_Range($strPeriod, $strDate);
+ $rangePeriod = new Piwik_Period_Range($strPeriod, $strDate, $oSite->getTimezone());
foreach($rangePeriod->getSubperiods() as $subPeriod)
{
$startDate = $subPeriod->getDateStart();
@@ -42,6 +42,13 @@ class Piwik_Archive_Array_IndexedByDate extends Piwik_Archive_Array
return 'date';
}
+ /**
+ * Adds metadata information to the Piwik_DataTable_Array
+ * using the information given by the Archive
+ *
+ * @param Piwik_DataTable_Array $table
+ * @param Piwik_Archive $archive
+ */
protected function loadMetadata(Piwik_DataTable_Array $table, $archive)
{
$table->metadata[$archive->getPrettyDate()] = array(
@@ -91,21 +98,22 @@ class Piwik_Archive_Array_IndexedByDate extends Piwik_Archive_Array
$arrayValues = array();
foreach($queries as $table => $aIds)
{
- $inIds = implode(', ', $aIds);
+ $inIds = implode(', ', array_filter($aIds));
if(empty($inIds))
{
// Probable timezone configuration error, i.e., mismatch between PHP and MySQL server.
continue;
}
- $sql = "SELECT value, name, UNIX_TIMESTAMP(date1) as timestamp
+ $sql = "SELECT value, name, date1 as startDate
FROM $table
WHERE idarchive IN ( $inIds )
AND name IN ( $inNames )";
$values = $db->fetchAll($sql);
foreach($values as $value)
{
- $arrayValues[$value['timestamp']][$value['name']] = (float)$value['value'];
+ $timestamp = Piwik_Date::factory($value['startDate'])->getTimestamp();
+ $arrayValues[$timestamp][$value['name']] = (float)$value['value'];
}
}