Skip to content

Commit

Permalink
Fix regression in archive.php cron (via PHP renderer) caused by Archi…
Browse files Browse the repository at this point in the history
…ve.php refactoring committed earlier.
  • Loading branch information
Benaka Moorthi committed Jun 9, 2013
1 parent a3f7a57 commit c3576db
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/Archive/DataTableFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ private function createDataTable($data, $keyMetadata)
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;
Expand Down

0 comments on commit c3576db

Please sign in to comment.