diff options
author | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 09:57:33 +0400 |
---|---|---|
committer | diosmosis <benakamoorthi@fastmail.fm> | 2013-10-22 09:57:54 +0400 |
commit | 777fa7f0b8963dc3ea5e0d47b1da3ec85cf93eb7 (patch) | |
tree | c4ce14f444222c26d0f2998f96ff0e6a66a6e102 | |
parent | 66add89b764c709869c1b4976a4a447a4e61be4c (diff) |
Refs #4200, move AddSummaryRow logic to Truncate, change AddSummaryRow logic to just add a summary row and fix bug in FrontController.
-rw-r--r-- | core/Archive.php | 5 | ||||
-rw-r--r-- | core/DataTable/Filter/AddSummaryRow.php | 2 | ||||
-rw-r--r-- | core/DataTable/Filter/Truncate.php | 13 |
3 files changed, 11 insertions, 9 deletions
diff --git a/core/Archive.php b/core/Archive.php index f55fc25b98..33e05b5d27 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -17,7 +17,8 @@ use Piwik\DataAccess\ArchiveSelector; use Piwik\Period\Range; /** - * The **Archive** class is used to query archive data. + * The **Archive** class is used to query cached analytics statistics + * (termed "archive data"). * * You can use **Archive** instances to get archive data for one or more sites, * for one or more periods and one optional segment. @@ -35,6 +36,8 @@ use Piwik\Period\Range; * If you're creating an API that returns report data, you may want to use the * [getDataTableFromArchive](#getDataTableFromArchive) helper function. * + * Learn more about _archiving_ [here](#). + * * ### Limitations * * - You cannot get data for multiple range periods in a single query. diff --git a/core/DataTable/Filter/AddSummaryRow.php b/core/DataTable/Filter/AddSummaryRow.php index a050e31e1a..c4483f0ecb 100644 --- a/core/DataTable/Filter/AddSummaryRow.php +++ b/core/DataTable/Filter/AddSummaryRow.php @@ -12,7 +12,7 @@ namespace Piwik\DataTable\Filter; use Piwik\DataTable\Filter; use Piwik\DataTable; -use Piwik\DataTable\Row; +use Piwik\DataTable\Row\DataTableSummaryRow; /** * Add a new row to the table containing a summary diff --git a/core/DataTable/Filter/Truncate.php b/core/DataTable/Filter/Truncate.php index 56aa4ea5b2..c803653a2d 100644 --- a/core/DataTable/Filter/Truncate.php +++ b/core/DataTable/Filter/Truncate.php @@ -13,6 +13,7 @@ namespace Piwik\DataTable\Filter; use Piwik\DataTable\Filter; use Piwik\DataTable; use Piwik\DataTable\Manager; +use Piwik\DataTable\Row; /** * @package Piwik @@ -47,14 +48,12 @@ class Truncate extends Filter public function filter($table) { $this->addSummaryRow($table); - $table->filter('ReplaceSummaryRowLabel'); + $table->queueFilter('ReplaceSummaryRowLabel'); if ($this->filterRecursive) { foreach ($table->getRows() as $row) { if ($row->isSubtableLoaded()) { - $idSubTable = $row->getIdSubDataTable(); - $subTable = Manager::getInstance()->getTable($idSubTable); - $subTable->filter('Truncate', array($this->truncateAfter)); + $this->filter($row->getSubtable()); } } } @@ -65,14 +64,14 @@ class Truncate extends Filter $table->filter('Sort', array($this->columnToSortByBeforeTruncating, 'desc')); - if ($table->getRowsCount() <= $this->startRowToSummarize + 1) { + if ($table->getRowsCount() <= $this->truncateAfter + 1) { return; } $rows = $table->getRows(); $count = $table->getRowsCount(); $newRow = new Row(); - for ($i = $this->startRowToSummarize; $i < $count; $i++) { + for ($i = $this->truncateAfter; $i < $count; $i++) { if (!isset($rows[$i])) { // case when the last row is a summary row, it is not indexed by $cout but by DataTable::ID_SUMMARY_ROW $summaryRow = $table->getRowFromId(DataTable::ID_SUMMARY_ROW); @@ -88,7 +87,7 @@ class Truncate extends Filter $newRow->setColumns(array('label' => $this->labelSummaryRow) + $newRow->getColumns()); if ($this->deleteRows) { - $table->filter('Limit', array(0, $this->startRowToSummarize)); + $table->filter('Limit', array(0, $this->truncateAfter)); } $table->addSummaryRow($newRow); unset($rows); |