From 8364a721836f54f1d84970449e9ecfa67487a844 Mon Sep 17 00:00:00 2001 From: David mattei Date: Sat, 7 Oct 2023 08:26:00 +0200 Subject: [PATCH] feat(core/unpublish): db revisions not updated (#632) --- EMS/core-bundle/src/Command/Environment/UnpublishCommand.php | 3 ++- EMS/core-bundle/src/Service/EnvironmentService.php | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/EMS/core-bundle/src/Command/Environment/UnpublishCommand.php b/EMS/core-bundle/src/Command/Environment/UnpublishCommand.php index ec81634cc..369d4d062 100644 --- a/EMS/core-bundle/src/Command/Environment/UnpublishCommand.php +++ b/EMS/core-bundle/src/Command/Environment/UnpublishCommand.php @@ -68,12 +68,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int foreach ($this->revisionSearcher->search($this->environment, $search) as $revisions) { $this->revisionSearcher->lock($revisions, $this->lockUser); $this->publishService->bulkStart($bulkSize, $this->logger); + $transactionEnvironment = $this->environmentService->clearCache()->giveByName($this->environment->getName()); foreach ($revisions->transaction() as $revision) { $this->io->progressAdvance(); try { - $this->publishService->bulkUnpublish($revision, $this->environment); + $this->publishService->bulkUnpublish($revision, $transactionEnvironment); ++$this->counter; } catch (\LogicException $e) { $this->warnings[$e->getMessage()] = ($this->warnings[$e->getMessage()] ?? 0) + 1; diff --git a/EMS/core-bundle/src/Service/EnvironmentService.php b/EMS/core-bundle/src/Service/EnvironmentService.php index 4b70d4ba2..2e642383f 100644 --- a/EMS/core-bundle/src/Service/EnvironmentService.php +++ b/EMS/core-bundle/src/Service/EnvironmentService.php @@ -331,11 +331,13 @@ public function getUserPublishEnvironments(): Collection }); } - public function clearCache(): void + public function clearCache(): self { $this->environments = []; $this->notSnapshotEnvironments = []; $this->environmentsById = []; + + return $this; } public function updateEnvironment(Environment $environment): void