From b82aca52957a0f836f169ac4e3b67f48bce2622f Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Sun, 21 Sep 2014 16:21:50 +1200
Subject: [PATCH] refs #5933 we must specifically invalidate day reports so
 that monthly reports have a chance to be re-processed. added note in the API
 comment.

---
 plugins/CoreAdminHome/API.php                         | 4 +++-
 tests/PHPUnit/Integration/ArchiveInvalidationTest.php | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php
index bc26368f5d..530cc10156 100644
--- a/plugins/CoreAdminHome/API.php
+++ b/plugins/CoreAdminHome/API.php
@@ -57,7 +57,9 @@ class API extends \Piwik\Plugin\API
      *
      * @param string $idSites Comma separated list of idSite that have had data imported for the specified dates
      * @param string $dates Comma separated list of dates to invalidate for all these websites
-     * @param string $period If specified (one of day, week, month, year, range) it will only delete archives for this period
+     * @param string $period If specified (one of day, week, month, year, range) it will only delete archives for this period.
+     *                      Note: because week, month, year, range reports aggregate day reports then you need to specifically invalidate day reports to see
+     *                      other periods reports processed..
      * @throws Exception
      * @return array
      */
diff --git a/tests/PHPUnit/Integration/ArchiveInvalidationTest.php b/tests/PHPUnit/Integration/ArchiveInvalidationTest.php
index 36f0cdf0cf..a45aaac72c 100644
--- a/tests/PHPUnit/Integration/ArchiveInvalidationTest.php
+++ b/tests/PHPUnit/Integration/ArchiveInvalidationTest.php
@@ -129,7 +129,9 @@ class ArchiveInvalidationTest extends IntegrationTestCase
         $r = new Request("module=API&method=CoreAdminHome.invalidateArchivedReports&idSites=" . self::$fixture->idSite1 . "&dates=" . $dateToInvalidate1->format('Y-m-d'));
         $this->assertApiResponseHasNoError($r->process());
 
-        // Month reports only are invalidated and we test our weekly report will still show old data.
+        // Days & Months reports only are invalidated and we test our weekly report will still show old data.
+        $r = new Request("module=API&method=CoreAdminHome.invalidateArchivedReports&period=day&idSites=" . self::$fixture->idSite2 . "&dates=" . $dateToInvalidate2->format('Y-m-d'));
+        $this->assertApiResponseHasNoError($r->process());
         $r = new Request("module=API&method=CoreAdminHome.invalidateArchivedReports&period=month&idSites=" . self::$fixture->idSite2 . "&dates=" . $dateToInvalidate2->format('Y-m-d'));
         $this->assertApiResponseHasNoError($r->process());
 
-- 
GitLab