Skip to content

Commit

Permalink
Remove no longer used climulti request parser
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Aug 19, 2024
1 parent c6ebbdf commit d88dcc7
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 318 deletions.
113 changes: 0 additions & 113 deletions core/CliMulti/RequestParser.php

This file was deleted.

8 changes: 0 additions & 8 deletions core/CronArchive.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Piwik\CronArchive\FixedSiteIds;
use Piwik\CronArchive\Performance\Logger;
use Piwik\Archive\ArchiveInvalidator;
use Piwik\CliMulti\RequestParser;
use Piwik\CronArchive\QueueConsumer;
use Piwik\CronArchive\SharedSiteIds;
use Piwik\CronArchive\StopArchiverException;
Expand Down Expand Up @@ -221,11 +220,6 @@ class CronArchive
*/
private $archiveFilter;

/**
* @var RequestParser
*/
private $cliMultiRequestParser;

/**
* @var bool|mixed
*/
Expand All @@ -250,7 +244,6 @@ public function __construct(LoggerInterface $logger = null)
$this->periodIdsToLabels = array_flip(Piwik::$idPeriods);

$this->supportsAsync = $this->makeCliMulti()->supportsAsync();
$this->cliMultiRequestParser = new RequestParser($this->supportsAsync);

$this->archiveFilter = new ArchiveFilter();
}
Expand Down Expand Up @@ -380,7 +373,6 @@ public function run()
$this->model,
$this->segmentArchiving,
$this,
$this->cliMultiRequestParser,
$this->archiveFilter
);

Expand Down
8 changes: 0 additions & 8 deletions core/CronArchive/QueueConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Piwik\ArchiveProcessor\Loader;
use Piwik\ArchiveProcessor\Parameters;
use Piwik\ArchiveProcessor\Rules;
use Piwik\CliMulti\RequestParser;
use Piwik\CronArchive;
use Piwik\DataAccess\ArchiveSelector;
use Piwik\DataAccess\Model;
Expand Down Expand Up @@ -78,11 +77,6 @@ class QueueConsumer
*/
private $periodIdsToLabels;

/**
* @var RequestParser
*/
private $cliMultiRequestParser;

/**
* @var int
*/
Expand Down Expand Up @@ -118,7 +112,6 @@ public function __construct(
Model $model,
SegmentArchiving $segmentArchiving,
CronArchive $cronArchive,
RequestParser $cliMultiRequestParser,
ArchiveFilter $archiveFilter = null
) {
$this->logger = $logger;
Expand All @@ -128,7 +121,6 @@ public function __construct(
$this->model = $model;
$this->segmentArchiving = $segmentArchiving;
$this->cronArchive = $cronArchive;
$this->cliMultiRequestParser = $cliMultiRequestParser;
$this->archiveFilter = $archiveFilter;

// if we skip or can't process an idarchive, we want to ignore it the next time we look for an invalidated
Expand Down
34 changes: 5 additions & 29 deletions tests/PHPUnit/Integration/CronArchive/QueueConsumerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
namespace Piwik\Tests\Integration\CronArchive;

use Piwik\ArchiveProcessor\Rules;
use Piwik\CliMulti\RequestParser;
use Piwik\Common;
use Piwik\Config;
use Piwik\Period\Day;
Expand Down Expand Up @@ -67,7 +66,6 @@ public function testConsumerIgnoresPeriodsThatHaveBeenDisabledInApi()
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -166,13 +164,12 @@ public function testInvalidateConsumeOrder()

$queueConsumer = new QueueConsumer(
StaticContainer::get(LoggerInterface::class),
new FixedSiteIds([1,2,3]),
new FixedSiteIds([1, 2, 3]),
3,
24,
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -354,13 +351,12 @@ public function testInvalidateConsumeOrder()

$queueConsumer = new QueueConsumer(
StaticContainer::get(LoggerInterface::class),
new FixedSiteIds([1,2,3]),
new FixedSiteIds([1, 2, 3]),
3,
24,
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -482,7 +478,6 @@ public function testPluginInvalidationDeletedIfUsableArchiveExists()
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -563,7 +558,6 @@ public function testSkipSegmentsToday()
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -679,7 +673,6 @@ public function testMaxWebsitesToProcess()
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);
$this->assertNull($queueConsumer->setMaxSitesToProcess());
Expand Down Expand Up @@ -822,7 +815,6 @@ public function testCanSkipArchiveBecauseNoPointReturnsTrueIfDateRangeHasNoVisit
new Model(),
new SegmentArchiving(),
$cronArchive,
new RequestParser(true),
$archiveFilter
);

Expand Down Expand Up @@ -851,7 +843,6 @@ public function testCanSkipArchiveBecauseNoPointReturnsFalseIfDateRangeHasVisits
new Model(),
new SegmentArchiving(),
new CronArchive(),
new RequestParser(true),
$this->makeTestArchiveFilter()
);

Expand Down Expand Up @@ -880,7 +871,6 @@ public function testUsableArchiveExistsReturnsTrueIfDateRangeHasVisitsAndPeriodI
new Model(),
new SegmentArchiving(),
new CronArchive(),
new RequestParser(true),
$this->makeTestArchiveFilter()
);

Expand Down Expand Up @@ -916,7 +906,6 @@ public function testUsableArchiveExistsReturnsTrueIfDateRangeHasVisitsAndPeriodI
new Model(),
new SegmentArchiving(),
new CronArchive(),
new RequestParser(true),
$this->makeTestArchiveFilter()
);

Expand Down Expand Up @@ -955,7 +944,6 @@ public function testCanSkipArchiveBecauseNoPointReturnsFalseIfDateRangeHasVisits
new Model(),
new SegmentArchiving(),
new CronArchive(),
new RequestParser(true),
$this->makeTestArchiveFilter()
);

Expand Down Expand Up @@ -991,7 +979,6 @@ public function testCanSkipArchiveBecauseNoPointReturnsTrueSegmentArchivingForPl
new Model(),
new SegmentArchiving(),
new CronArchive(),
new RequestParser(true),
$this->makeTestArchiveFilter()
);

Expand Down Expand Up @@ -1115,10 +1102,9 @@ public function testShouldSkipArchiveBecauseLowerPeriodOrSegmentIsInProgress($ex
Rules::setBrowserTriggerArchiving(true);

$this->insertInvalidations($existingInvalidations);
$cliRequestProcessor = $this->getMockRequestParser([]);

/** @var QueueConsumer $queueConsumer */
$queueConsumer = $this->getQueueConsumerWithMocks($cliRequestProcessor);
$queueConsumer = $this->getQueueConsumerWithMocks();

$periods = array_flip(Piwik::$idPeriods);

Expand Down Expand Up @@ -1394,23 +1380,13 @@ private function getMockCronArchive()
->getMock();
}

private function getMockRequestParser($cliMultiProcesses)
{
$mock = $this->getMockBuilder(RequestParser::class)
->disableOriginalConstructor()
->onlyMethods(['getInProgressArchivingCommands'])
->getMock();
$mock->method('getInProgressArchivingCommands')->willReturn($cliMultiProcesses);
return $mock;
}

private function getQueueConsumerWithMocks($cliRequestProcessor)
private function getQueueConsumerWithMocks()
{
$mockCronArchive = $this->getMockBuilder(CronArchive::class)
->disableOriginalConstructor()
->getMock();

return new QueueConsumer(new NullLogger(), null, null, null, new Model(), new SegmentArchiving(), $mockCronArchive, $cliRequestProcessor);
return new QueueConsumer(new NullLogger(), null, null, null, new Model(), new SegmentArchiving(), $mockCronArchive);
}

protected static function configureFixture($fixture)
Expand Down
Loading

0 comments on commit d88dcc7

Please sign in to comment.