diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-06-09 08:50:48 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-06-09 08:50:48 +0400 |
commit | c3576dbfa9af6ab4a613c63f715dd0006dad113e (patch) | |
tree | 561013f95c0a364f2768eb55694ad578e80c3319 /core | |
parent | a3f7a5758e13dd0abc563a605f92d3228d00135a (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.php | 12 |
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; |