diff options
author | sgiehl <stefan@piwik.org> | 2016-11-01 00:10:14 +0300 |
---|---|---|
committer | sgiehl <stefan@piwik.org> | 2016-11-01 01:38:23 +0300 |
commit | 6102454146b673a16ab7f45de391e8f1ae8a096e (patch) | |
tree | 579b2a826acecd0a4fd10d5cd0b10b4e06703bf1 /core/Archive.php | |
parent | 473c770898231f5f41048f0010ca616034877809 (diff) |
Removes deprecated method Archive::getDataTableFromArchive
Diffstat (limited to 'core/Archive.php')
-rw-r--r-- | core/Archive.php | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/core/Archive.php b/core/Archive.php index a8b87e439e..4fc7e219bc 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -32,7 +32,7 @@ use Piwik\Period\Factory as PeriodFactory; * reports using the {@link getBlob()}, {@link getDataTable()} and {@link getDataTableExpanded()} methods. * * If you're creating an API that returns report data, you may want to use the - * {@link getDataTableFromArchive()} helper function. + * {@link createDataTableFromArchive()} helper function. * * ### Learn more * @@ -85,8 +85,7 @@ use Piwik\Period\Factory as PeriodFactory; * * public function getMyReport($idSite, $period, $date, $segment = false, $expanded = false) * { - * $dataTable = Archive::getDataTableFromArchive('MyPlugin_MyReport', $idSite, $period, $date, $segment, $expanded); - * $dataTable->queueFilter('ReplaceColumnNames'); + * $dataTable = Archive::createDataTableFromArchive('MyPlugin_MyReport', $idSite, $period, $date, $segment, $expanded); * return $dataTable; * } * @@ -438,64 +437,37 @@ class Archive * Helper function that creates an Archive instance and queries for report data using * query parameter data. API methods can use this method to reduce code redundancy. * - * @param string $name The name of the report to return. + * @param string $recordName The name of the report to return. * @param int|string|array $idSite @see {@link build()} * @param string $period @see {@link build()} * @param string $date @see {@link build()} * @param string $segment @see {@link build()} * @param bool $expanded If true, loads all subtables. See {@link getDataTableExpanded()} + * @param bool $flat If true, loads all subtables and disabled all recursive filters. * @param int|null $idSubtable See {@link getDataTableExpanded()} * @param int|null $depth See {@link getDataTableExpanded()} - * @throws \Exception - * @return DataTable|DataTable\Map See {@link getDataTable()} and - * {@link getDataTableExpanded()} for more - * information - * @deprecated Since Piwik 2.12.0 Use Archive::createDataTableFromArchive() instead + * @return DataTable|DataTable\Map */ - public static function getDataTableFromArchive($name, $idSite, $period, $date, $segment, $expanded, - $idSubtable = null, $depth = null) + public static function createDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded = false, $flat = false, $idSubtable = null, $depth = null) { Piwik::checkUserHasViewAccess($idSite); + if ($flat && !$idSubtable) { + $expanded = true; + } + $archive = Archive::build($idSite, $period, $date, $segment, $_restrictSitesToLogin = false); if ($idSubtable === false) { $idSubtable = null; } if ($expanded) { - $dataTable = $archive->getDataTableExpanded($name, $idSubtable, $depth); + $dataTable = $archive->getDataTableExpanded($recordName, $idSubtable, $depth); } else { - $dataTable = $archive->getDataTable($name, $idSubtable); + $dataTable = $archive->getDataTable($recordName, $idSubtable); } $dataTable->queueFilter('ReplaceSummaryRowLabel'); - - return $dataTable; - } - - /** - * Helper function that creates an Archive instance and queries for report data using - * query parameter data. API methods can use this method to reduce code redundancy. - * - * @param string $recordName The name of the report to return. - * @param int|string|array $idSite @see {@link build()} - * @param string $period @see {@link build()} - * @param string $date @see {@link build()} - * @param string $segment @see {@link build()} - * @param bool $expanded If true, loads all subtables. See {@link getDataTableExpanded()} - * @param bool $flat If true, loads all subtables and disabled all recursive filters. - * @param int|null $idSubtable See {@link getDataTableExpanded()} - * @param int|null $depth See {@link getDataTableExpanded()} - * @return DataTable|DataTable\Map - */ - public static function createDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded = false, $flat = false, $idSubtable = null, $depth = null) - { - if ($flat && !$idSubtable) { - $expanded = true; - } - - $dataTable = self::getDataTableFromArchive($recordName, $idSite, $period, $date, $segment, $expanded, $idSubtable, $depth); - $dataTable->queueFilter('ReplaceColumnNames'); if ($expanded) { |