From 0fbdbe8ed85bce669fcc39a28c90b36be5cdebd0 Mon Sep 17 00:00:00 2001 From: Chuck Adams Date: Sun, 8 Dec 2024 20:03:43 -0700 Subject: [PATCH 1/2] fix: ListServiceInterface::setName() to distinguish the commands --- src/Commands/Sync/Download/AbstractDownloadCommand.php | 1 + src/Commands/Sync/Meta/AbstractMetaFetchCommand.php | 1 + src/Services/List/AbstractListService.php | 6 +++++- src/Services/List/ListServiceInterface.php | 2 ++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Commands/Sync/Download/AbstractDownloadCommand.php b/src/Commands/Sync/Download/AbstractDownloadCommand.php index 8782252..b2f301c 100644 --- a/src/Commands/Sync/Download/AbstractDownloadCommand.php +++ b/src/Commands/Sync/Download/AbstractDownloadCommand.php @@ -38,6 +38,7 @@ protected function configure(): void ->addOption($category, null, InputOption::VALUE_OPTIONAL, "List of $category to request") ->addOption('force', null, InputOption::VALUE_NONE, 'Force download even if file exists') ->addOption('download-all', null, InputOption::VALUE_NONE, "Download all $category"); + $this->listService->setName($this->getName()); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Commands/Sync/Meta/AbstractMetaFetchCommand.php b/src/Commands/Sync/Meta/AbstractMetaFetchCommand.php index 8f02247..84cf222 100644 --- a/src/Commands/Sync/Meta/AbstractMetaFetchCommand.php +++ b/src/Commands/Sync/Meta/AbstractMetaFetchCommand.php @@ -60,6 +60,7 @@ protected function configure(): void InputOption::VALUE_REQUIRED, "List of $category (separated by commas) to explicitly update" ); + $this->listService->setName($this->getName()); } protected function execute(InputInterface $input, OutputInterface $output): int diff --git a/src/Services/List/AbstractListService.php b/src/Services/List/AbstractListService.php index f105a24..62f0ed3 100644 --- a/src/Services/List/AbstractListService.php +++ b/src/Services/List/AbstractListService.php @@ -21,12 +21,16 @@ public function __construct( protected ResourceType $type, protected string $origin = 'wp_org', ) { - $this->name = "list-{$type->plural()}@$origin"; $this->loadLatestRevisions(); } //region Public API + public function setName(string $name): void + { + $this->name = $name; + } + /** @return array */ public function getItems(): array { diff --git a/src/Services/List/ListServiceInterface.php b/src/Services/List/ListServiceInterface.php index 9901aac..15f6d2a 100644 --- a/src/Services/List/ListServiceInterface.php +++ b/src/Services/List/ListServiceInterface.php @@ -6,6 +6,8 @@ interface ListServiceInterface { + public function setName(string $name): void; + /** @return array */ public function getItems(): array; From 0101eef80290328972680adacd6a3df79c9686be Mon Sep 17 00:00:00 2001 From: Chuck Adams Date: Sun, 8 Dec 2024 20:08:57 -0700 Subject: [PATCH 2/2] fix: restore use of getRevisionTime() --- src/Services/List/AbstractListService.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Services/List/AbstractListService.php b/src/Services/List/AbstractListService.php index 62f0ed3..5e3e29b 100644 --- a/src/Services/List/AbstractListService.php +++ b/src/Services/List/AbstractListService.php @@ -41,9 +41,7 @@ public function getItems(): array /** @return array */ public function getUpdatedItems(): array { - // HACK: return everything until meta and download versions of ListService get different names - return $this->meta->getOpenVersions(-1); // FIXME: make getRevisionTime() work again - // return $this->meta->getOpenVersions($this->getRevisionTime()); + return $this->meta->getOpenVersions($this->getRevisionTime()); } public function preserveRevision(): string