diff options
author | diosmosis <benaka@piwik.pro> | 2015-03-05 09:58:56 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-03-05 09:59:09 +0300 |
commit | 0509923974ef44205cae1c349fac94430705dc6e (patch) | |
tree | 78173881495f89939a46590c7bf65cdee2a84f0e | |
parent | 534798ae6b20b6e5f8660a372a97162b8a0e90eb (diff) |
Refs #7181, move ArchiveInvalidator to Piwik\Archive\Invalidator away from Piwik\DataAccess since it iss not a DAO.
-rw-r--r-- | core/Archive.php | 4 | ||||
-rw-r--r-- | core/Archive/Invalidator.php (renamed from core/DataAccess/ArchiveInvalidator.php) | 8 | ||||
-rw-r--r-- | core/Archive/Purger.php | 2 | ||||
-rw-r--r-- | core/CronArchive.php | 4 | ||||
-rw-r--r-- | core/Tracker/Visit.php | 4 | ||||
-rw-r--r-- | plugins/CoreAdminHome/API.php | 4 | ||||
-rw-r--r-- | plugins/CoreAdminHome/Commands/FixDuplicateLogActions.php | 10 | ||||
-rw-r--r-- | plugins/SitesManager/SitesManager.php | 4 | ||||
-rw-r--r-- | plugins/SitesManager/tests/Integration/SitesManagerTest.php | 4 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/CronArchiveTest.php | 4 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php | 8 | ||||
-rw-r--r-- | tests/PHPUnit/Integration/Tracker/VisitTest.php | 4 | ||||
-rwxr-xr-x | tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php | 4 | ||||
-rwxr-xr-x | tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php | 2 |
14 files changed, 34 insertions, 32 deletions
diff --git a/core/Archive.php b/core/Archive.php index 60d6791726..25e6c6a494 100644 --- a/core/Archive.php +++ b/core/Archive.php @@ -10,7 +10,7 @@ namespace Piwik; use Piwik\Archive\Parameters; use Piwik\ArchiveProcessor\Rules; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\DataAccess\ArchiveSelector; use Piwik\Period\Factory as PeriodFactory; @@ -524,7 +524,7 @@ class Archive return; // all requested site ids were already handled } - $invalidator = new ArchiveInvalidator(); + $invalidator = new Invalidator(); $sitesPerDays = $invalidator->getRememberedArchivedReportsThatShouldBeInvalidated(); foreach ($sitesPerDays as $date => $siteIds) { diff --git a/core/DataAccess/ArchiveInvalidator.php b/core/Archive/Invalidator.php index 470dff1848..6b98061da1 100644 --- a/core/DataAccess/ArchiveInvalidator.php +++ b/core/Archive/Invalidator.php @@ -7,9 +7,11 @@ * */ -namespace Piwik\DataAccess; +namespace Piwik\Archive; use Piwik\CronArchive\SitesToReprocessDistributedList; +use Piwik\DataAccess\ArchiveTableCreator; +use Piwik\DataAccess\Model; use Piwik\Date; use Piwik\Db; use Piwik\Option; @@ -27,9 +29,9 @@ use Piwik\Site; * * The invalidated archives will be deleted by Purger * - * @package Piwik\DataAccess + * TODO: modify */ -class ArchiveInvalidator +class Invalidator { private $warningDates = array(); private $processedDates = array(); diff --git a/core/Archive/Purger.php b/core/Archive/Purger.php index 6f34fddead..633f2e4bfb 100644 --- a/core/Archive/Purger.php +++ b/core/Archive/Purger.php @@ -23,7 +23,7 @@ use Piwik\Plugins\CoreAdminHome\Tasks\ArchivesToPurgeDistributedList; * * This class purges two types of archives: * - * (1) Deletes invalidated archives (from ArchiveInvalidator) + * (1) Deletes invalidated archives (from Invalidator) * * (2) Deletes outdated archives (the temporary or errored archives) * diff --git a/core/CronArchive.php b/core/CronArchive.php index 9e592e58d2..7a970acb44 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -12,7 +12,7 @@ use Exception; use Piwik\ArchiveProcessor\Rules; use Piwik\CronArchive\FixedSiteIds; use Piwik\CronArchive\SharedSiteIds; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Exception\UnexpectedWebsiteFoundException; use Piwik\Metrics\Formatter; use Piwik\Period\Factory as PeriodFactory; @@ -977,7 +977,7 @@ class CronArchive public function invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain() { - $invalidator = new ArchiveInvalidator(); + $invalidator = new Invalidator(); $sitesPerDays = $invalidator->getRememberedArchivedReportsThatShouldBeInvalidated(); foreach ($sitesPerDays as $date => $siteIds) { diff --git a/core/Tracker/Visit.php b/core/Tracker/Visit.php index e5dbc69ef6..3a149cfbd0 100644 --- a/core/Tracker/Visit.php +++ b/core/Tracker/Visit.php @@ -11,7 +11,7 @@ namespace Piwik\Tracker; use Piwik\Common; use Piwik\Config; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Date; use Piwik\Exception\UnexpectedWebsiteFoundException; use Piwik\Network\IPUtils; @@ -682,7 +682,7 @@ class Visit implements VisitInterface $date = Date::factory((int) $time, $timezone); if (!$date->isToday()) { // we don't have to handle in case date is in future as it is not allowed by tracker - $invalidReport = new ArchiveInvalidator(); + $invalidReport = new Invalidator(); $invalidReport->rememberToInvalidateArchivedReportsLater($idSite, $date); } } diff --git a/plugins/CoreAdminHome/API.php b/plugins/CoreAdminHome/API.php index 60ba204d45..d3041a170d 100644 --- a/plugins/CoreAdminHome/API.php +++ b/plugins/CoreAdminHome/API.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\CoreAdminHome; use Exception; use Piwik\Container\StaticContainer; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Db; use Piwik\Piwik; use Piwik\Scheduler\Scheduler; @@ -69,7 +69,7 @@ class API extends \Piwik\Plugin\API Piwik::checkUserHasAdminAccess($idSites); - $invalidator = new ArchiveInvalidator(); + $invalidator = new Invalidator(); $output = $invalidator->markArchivesAsInvalidated($idSites, $dates, $period); Site::clearCache(); diff --git a/plugins/CoreAdminHome/Commands/FixDuplicateLogActions.php b/plugins/CoreAdminHome/Commands/FixDuplicateLogActions.php index 47a058c7ad..b26b866e27 100644 --- a/plugins/CoreAdminHome/Commands/FixDuplicateLogActions.php +++ b/plugins/CoreAdminHome/Commands/FixDuplicateLogActions.php @@ -11,7 +11,7 @@ namespace Piwik\Plugins\CoreAdminHome\Commands; use Piwik\Common; use Piwik\Container\StaticContainer; use Piwik\DataAccess\Actions; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Plugin\ConsoleCommand; use Piwik\Plugins\CoreAdminHome\Model\DuplicateActionRemover; use Piwik\Timer; @@ -39,7 +39,7 @@ class FixDuplicateLogActions extends ConsoleCommand /** * Used to invalidate archives. Only used if $shouldInvalidateArchives is true. * - * @var ArchiveInvalidator + * @var Invalidator */ private $archiveInvalidator; @@ -65,17 +65,17 @@ class FixDuplicateLogActions extends ConsoleCommand /** * Constructor. * - * @param ArchiveInvalidator $invalidator + * @param Invalidator $invalidator * @param DuplicateActionRemover $duplicateActionRemover * @param Actions $actionsAccess * @param LoggerInterface $logger */ - public function __construct(ArchiveInvalidator $invalidator = null, DuplicateActionRemover $duplicateActionRemover = null, + public function __construct(Invalidator $invalidator = null, DuplicateActionRemover $duplicateActionRemover = null, Actions $actionsAccess = null, LoggerInterface $logger = null) { parent::__construct(); - $this->archiveInvalidator = $invalidator ?: new ArchiveInvalidator(); + $this->archiveInvalidator = $invalidator ?: new Invalidator(); $this->duplicateActionRemover = $duplicateActionRemover ?: new DuplicateActionRemover(); $this->actionsAccess = $actionsAccess ?: new Actions(); $this->logger = $logger ?: StaticContainer::get('Psr\Log\LoggerInterface'); diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index f06ff69948..d88c2e7c41 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -7,7 +7,7 @@ * */ namespace Piwik\Plugins\SitesManager; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Tracker\Cache; /** @@ -38,7 +38,7 @@ class SitesManager extends \Piwik\Plugin // we do not delete logs here on purpose (you can run these queries on the log_ tables to delete all data) Cache::deleteCacheWebsiteAttributes($idSite); - $archiveInvalidator = new ArchiveInvalidator(); + $archiveInvalidator = new Invalidator(); $archiveInvalidator->forgetRememberedArchivedReportsToInvalidateForSite($idSite); } diff --git a/plugins/SitesManager/tests/Integration/SitesManagerTest.php b/plugins/SitesManager/tests/Integration/SitesManagerTest.php index 135f505f01..9fc69fdfde 100644 --- a/plugins/SitesManager/tests/Integration/SitesManagerTest.php +++ b/plugins/SitesManager/tests/Integration/SitesManagerTest.php @@ -10,7 +10,7 @@ namespace Piwik\Plugins\SitesManager\tests\Integration; use Piwik\Access; use Piwik\Cache; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Date; use Piwik\Plugins\SitesManager\SitesManager; use Piwik\Tests\Framework\Fixture; @@ -56,7 +56,7 @@ class SitesManagerTest extends IntegrationTestCase public function test_onSiteDeleted_shouldRemoveRememberedArchiveReports() { - $archive = new ArchiveInvalidator(); + $archive = new Invalidator(); $archive->rememberToInvalidateArchivedReportsLater($this->siteId, Date::factory('2014-04-05')); $archive->rememberToInvalidateArchivedReportsLater($this->siteId, Date::factory('2014-04-06')); $archive->rememberToInvalidateArchivedReportsLater(4949, Date::factory('2014-04-05')); diff --git a/tests/PHPUnit/Integration/CronArchiveTest.php b/tests/PHPUnit/Integration/CronArchiveTest.php index a85f227802..9397fe511c 100644 --- a/tests/PHPUnit/Integration/CronArchiveTest.php +++ b/tests/PHPUnit/Integration/CronArchiveTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\Integration; use Piwik\CronArchive; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Date; use Piwik\Db; use Piwik\Plugins\CoreAdminHome\tests\Framework\Mock\API; @@ -46,7 +46,7 @@ class CronArchiveTest extends IntegrationTestCase public function test_getColumnNamesFromTable() { - $ar = new ArchiveInvalidator(); + $ar = new Invalidator(); $ar->rememberToInvalidateArchivedReportsLater(1, Date::factory('2014-04-05')); $ar->rememberToInvalidateArchivedReportsLater(2, Date::factory('2014-04-05')); $ar->rememberToInvalidateArchivedReportsLater(2, Date::factory('2014-04-06')); diff --git a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php index fbf2c0b7a9..24e178b153 100644 --- a/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php +++ b/tests/PHPUnit/Integration/DataAccess/ArchiveInvalidatorTest.php @@ -11,17 +11,17 @@ namespace Piwik\Tests\Integration\DataAccess; use Piwik\Date; use Piwik\Option; use Piwik\Tests\Framework\TestCase\IntegrationTestCase; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; /** * @group Archiver - * @group ArchiveInvalidator + * @group Invalidator * @group DataAccess */ class ArchiveInvalidatorTest extends IntegrationTestCase { /** - * @var ArchiveInvalidator + * @var Invalidator */ private $invalidator; @@ -29,7 +29,7 @@ class ArchiveInvalidatorTest extends IntegrationTestCase { parent::setUp(); - $this->invalidator = new ArchiveInvalidator(); + $this->invalidator = new Invalidator(); } public function test_rememberToInvalidateArchivedReportsLater_shouldCreateAnEntryInCaseThereIsNoneYet() diff --git a/tests/PHPUnit/Integration/Tracker/VisitTest.php b/tests/PHPUnit/Integration/Tracker/VisitTest.php index bbbb972cc3..ed767b1ea0 100644 --- a/tests/PHPUnit/Integration/Tracker/VisitTest.php +++ b/tests/PHPUnit/Integration/Tracker/VisitTest.php @@ -11,7 +11,7 @@ namespace Piwik\Tests\Integration\Tracker; use Piwik\Access; use Piwik\Cache; use Piwik\CacheId; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Date; use Piwik\Network\IPUtils; use Piwik\Plugin\Manager; @@ -370,7 +370,7 @@ class VisitTest extends IntegrationTestCase $visit->handle(); - $archive = new ArchiveInvalidator(); + $archive = new Invalidator(); $remembered = $archive->getRememberedArchivedReportsThatShouldBeInvalidated(); $this->assertSame($expectedRemeberedArchivedReports, $remembered); diff --git a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php index 56dc98e9a0..3c1509f0c6 100755 --- a/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php +++ b/tests/PHPUnit/System/TwoVisitorsTwoWebsitesDifferentDaysConversionsTest.php @@ -9,7 +9,7 @@ namespace Piwik\Tests\System; use Piwik\Archive; use Piwik\Cache; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\Option; use Piwik\Plugins\Goals\Archiver; use Piwik\Segment; @@ -172,7 +172,7 @@ class TwoVisitorsTwoWebsitesDifferentDaysConversionsTest extends SystemTestCase $this->assertEquals(array(self::$fixture->idSite1, self::$fixture->idSite2), $cache->fetch('Archive.SiteIdsOfRememberedReportsInvalidated')); - $invalidator = new ArchiveInvalidator(); + $invalidator = new Invalidator(); self::$fixture->trackVisits(); diff --git a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php index 55faf4b3be..4a74c954bc 100755 --- a/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php +++ b/tests/PHPUnit/System/TwoVisitsWithCustomVariablesSegmentMatchVisitorTypeTest.php @@ -8,7 +8,7 @@ namespace Piwik\Tests\System; use Piwik\Common; -use Piwik\DataAccess\ArchiveInvalidator; +use Piwik\Archive\Invalidator; use Piwik\CronArchive\SitesToReprocessDistributedList; use Piwik\Db; use Piwik\Tests\Framework\TestCase\SystemTestCase; |