diff options
author | Zoltan Flamis <zoltan@innocraft.com> | 2021-05-07 05:03:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-07 05:03:03 +0300 |
commit | 1fcc10569378263775a1f8a3e2429406da9423ce (patch) | |
tree | aa80450b3bc334e420baf3239cfcb674c0cae9d3 /plugins/CoreConsole | |
parent | 39361b179efc476a81e391b886e0b3913b994499 (diff) |
Make archiving process to respect process_new_segments_from settings (#17351)
* update canSkipThisArchive in Loader
* Update Loader.php
* Update Loader.php
* make cronarchive respect segment creation
* check for null
* do not use force-date-last-n in test
* fix some other tests
* fix other test
* add deprecated message
* Update UITestFixture.php
* wip
* reafactor and add tests
* take into account requested report
* refactor if
* refactoring
* fix bug
Co-authored-by: Thomas Steur <tsteur@users.noreply.github.com>
Diffstat (limited to 'plugins/CoreConsole')
-rw-r--r-- | plugins/CoreConsole/Commands/CoreArchiver.php | 10 | ||||
-rw-r--r-- | plugins/CoreConsole/tests/System/ArchiveCronTest.php | 5 |
2 files changed, 11 insertions, 4 deletions
diff --git a/plugins/CoreConsole/Commands/CoreArchiver.php b/plugins/CoreConsole/Commands/CoreArchiver.php index 1b78f5d5fb..ad16b543e4 100644 --- a/plugins/CoreConsole/Commands/CoreArchiver.php +++ b/plugins/CoreConsole/Commands/CoreArchiver.php @@ -23,6 +23,11 @@ class CoreArchiver extends ConsoleCommand protected function execute(InputInterface $input, OutputInterface $output) { + if($input->getOption('force-date-last-n')) { + $message = '"force-date-last-n" is deprecated. Please use the "process_new_segments_from" INI configuration option instead.'; + $output->writeln('<comment>' . $message .'</comment>'); + } + $archiver = self::makeArchiver($input->getOption('url'), $input); $archiver->main(); } @@ -38,7 +43,6 @@ class CoreArchiver extends ConsoleCommand $archiver->shouldArchiveSpecifiedSites = self::getSitesListOption($input, "force-idsites"); $archiver->shouldSkipSpecifiedSites = self::getSitesListOption($input, "skip-idsites"); $archiver->phpCliConfigurationOptions = $input->getOption("php-cli-options"); - $archiver->dateLastForced = $input->getOption('force-date-last-n'); $archiver->concurrentRequestsPerWebsite = $input->getOption('concurrent-requests-per-website'); $archiver->maxConcurrentArchivers = $input->getOption('concurrent-archivers'); $archiver->shouldArchiveAllSites = $input->getOption('force-all-websites'); @@ -91,8 +95,8 @@ class CoreArchiver extends ConsoleCommand 'If specified, segments will be only archived for yesterday, but not today. If the segment was created or changed recently, then it will still be archived for today and the setting will be ignored for this segment.'); $command->addOption('force-periods', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for these Periods (comma separated eg. day,week,month,year,range)"); - $command->addOption('force-date-last-n', null, InputOption::VALUE_REQUIRED, - "This last N number of years of data to invalidate when a recently created or updated segment is found.", 7); + $command->addOption('force-date-last-n', null, InputOption::VALUE_OPTIONAL, + "Deprecated. Please use the \"process_new_segments_from\" INI configuration option instead."); $command->addOption('force-date-range', null, InputOption::VALUE_OPTIONAL, "If specified, archiving will be processed only for periods included in this date range. Format: YYYY-MM-DD,YYYY-MM-DD"); $command->addOption('force-idsegments', null, InputOption::VALUE_REQUIRED, diff --git a/plugins/CoreConsole/tests/System/ArchiveCronTest.php b/plugins/CoreConsole/tests/System/ArchiveCronTest.php index bbc48d31c9..70839f54b3 100644 --- a/plugins/CoreConsole/tests/System/ArchiveCronTest.php +++ b/plugins/CoreConsole/tests/System/ArchiveCronTest.php @@ -432,7 +432,7 @@ class ArchiveCronTest extends SystemTestCase $urlToProxy = Fixture::getRootUrl() . 'tests/PHPUnit/proxy/index.php'; // create the command - $cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\" --force-date-last-n=10"; + $cmd = "php \"$archivePhpScript\" --url=\"$urlToProxy\""; foreach ($options as $name => $value) { $cmd .= " $name"; if ($value !== null) { @@ -464,6 +464,9 @@ class ArchiveCronTest extends SystemTestCase }, 'Tests.log.allowAllHandlers' => true, + + CronArchive\SegmentArchiving::class => \DI\object() + ->constructorParameter('beginningOfTimeLastNInYears', 10) ); } |