From eaa4c36aff234a3b9d247e189a04538162b5c1ad Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Tue, 15 Sep 2015 07:19:24 +1200
Subject: [PATCH] Fixes #8784 Deprecate the API.getLastDate method as it is
 un-used in Piwik

---
 CHANGELOG.md                                 | 3 ++-
 plugins/API/API.php                          | 3 +++
 tests/PHPUnit/Unit/DeprecatedMethodsTest.php | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5218540d6c..a9628625ac 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,7 +9,8 @@ This is a changelog for Piwik platform developers. All changes for our HTTP API'
 * We fixed a bug where the API method `Sites.getPatternMatchSites` only returned a very limited number of websites by default. We now return all websites by default unless a limit is specified specifically.
 
 ### Deprecations
-* The API method `SitesManager.getSitesIdWithVisits` has been deprecated and will be removed in Piwik 3.0
+* The HTTP API method `SitesManager.getSitesIdWithVisits` has been deprecated and will be removed in Piwik 3.0
+* The HTTP API method `API.getLastDate` has been deprecated and will be removed in Piwik 3.0
 * The API method `\Piwik\Plugin::getListHooksRegistered()` has been deprecated and will be removed in Piwik 3.0. Use `\Piwik\Plugin::registerEvents()` instead.
 * The following events have been deprecated and will be removed in Piwik 3.0. Use [dimensions](http://developer.piwik.org/guides/dimensions) instead.
  * `Tracker.existingVisitInformation`
diff --git a/plugins/API/API.php b/plugins/API/API.php
index 7027756ccd..dcdacf40b2 100644
--- a/plugins/API/API.php
+++ b/plugins/API/API.php
@@ -413,6 +413,9 @@ class API extends \Piwik\Plugin\API
             $language, $idGoal, $legendAppendMetric, $labelUseAbsoluteUrl);
     }
 
+    /**
+     * @deprecated
+     */
     public function getLastDate($date, $period)
     {
         $lastDate = Range::getLastDate($date, $period);
diff --git a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
index 442280cb8d..8d797576d3 100644
--- a/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
+++ b/tests/PHPUnit/Unit/DeprecatedMethodsTest.php
@@ -16,6 +16,7 @@ use Piwik\Version;
 use ReflectionClass;
 
 /**
+ * @group DeprecatedMethodsTest
  * @group Core
  */
 class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase
@@ -70,6 +71,7 @@ class DeprecatedMethodsTest extends \PHPUnit_Framework_TestCase
         $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Menu\MenuAbstract', 'add');
         $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Archive', 'getDataTableFromArchive');
         $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Plugin', 'getListHooksRegistered');
+        $this->assertDeprecatedMethodIsRemovedInPiwik3('\Piwik\Plugins\API\API', 'getLastDate');
     }
 
     private function assertDeprecatedMethodIsRemoved($className, $method, $removalDate)
-- 
GitLab