Skip to content

Commit

Permalink
feat(core/unpublish): db revisions not updated (ems-project#632)
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidmattei authored Oct 7, 2023
1 parent 3d20c31 commit 8364a72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion EMS/core-bundle/src/Command/Environment/UnpublishCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion EMS/core-bundle/src/Service/EnvironmentService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8364a72

Please sign in to comment.