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
path: root/core
diff options
context:
space:
mode:
authorBenaka Moorthi <benaka.moorthi@gmail.com>2013-06-09 08:50:48 +0400
committerBenaka Moorthi <benaka.moorthi@gmail.com>2013-06-09 08:50:48 +0400
commitc3576dbfa9af6ab4a613c63f715dd0006dad113e (patch)
tree561013f95c0a364f2768eb55694ad578e80c3319 /core
parenta3f7a5758e13dd0abc563a605f92d3228d00135a (diff)
Fix regression in archive.php cron (via PHP renderer) caused by Archive.php refactoring committed earlier.
Diffstat (limited to 'core')
-rw-r--r--core/Archive/DataTableFactory.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/core/Archive/DataTableFactory.php b/core/Archive/DataTableFactory.php
index 6333545380..bb19d390ed 100644
--- a/core/Archive/DataTableFactory.php
+++ b/core/Archive/DataTableFactory.php
@@ -272,6 +272,18 @@ class Piwik_Archive_DataTableFactory
Piwik_Archive_DataCollection::removeMetadataFromDataRow($data);
$table->addRow(new Piwik_DataTable_Row(array(Piwik_DataTable_Row::COLUMNS => $data)));
+ } else {
+ // if we're querying numeric data, we couldn't find any, and we're only
+ // looking for one metric, add a row w/ one column w/ value 0. this is to
+ // ensure that the PHP renderer outputs 0 when only one column is queried.
+ // w/o this code, an empty array would be created, and other parts of Piwik
+ // would break.
+ if (count($this->dataNames) == 1) {
+ $name = reset($this->dataNames);
+ $table->addRow(new Piwik_DataTable_Row(array(
+ Piwik_DataTable_Row::COLUMNS => array($name => 0)
+ )));
+ }
}
$result = $table;