From 95bd58e53e8db9eaed54707d93e6fb5bd5cb7351 Mon Sep 17 00:00:00 2001 From: Timon Heuser Date: Mon, 19 Oct 2026 11:17:43 +0200 Subject: [PATCH] BUGFIX: no message shown after trying to remove a release --- Classes/Controller/BackendController.php | 7 ++++++- Classes/Transfer/ContentReleaseCleaner.php | 7 ++++--- phpstan-baseline.neon | 5 ----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Classes/Controller/BackendController.php b/Classes/Controller/BackendController.php index 00d990e..b900a11 100644 --- a/Classes/Controller/BackendController.php +++ b/Classes/Controller/BackendController.php @@ -228,11 +228,16 @@ public function removeAction(string $contentReleaseIdentifier, string $redisInst $bufferedOutput = new BufferedOutput(); $logger = ContentReleaseLogger::fromSymfonyOutput($bufferedOutput, $contentReleaseIdentifierToRemove); - $this->contentReleaseCleaner->removeRelease( + $removed = $this->contentReleaseCleaner->removeRelease( $contentReleaseIdentifierToRemove, $redisInstanceIdentifier, $logger, ); + if (!$removed) { + $this->addFlashMessage($bufferedOutput->fetch(), '', Message::SEVERITY_ERROR); + } else { + $this->addFlashMessage('Release was removed.', '', Message::SEVERITY_OK); + } $this->redirect('index', null, null, ['contentStore' => $redisInstanceIdentifier->getIdentifier()]); } diff --git a/Classes/Transfer/ContentReleaseCleaner.php b/Classes/Transfer/ContentReleaseCleaner.php index 42365ac..fe81fc3 100644 --- a/Classes/Transfer/ContentReleaseCleaner.php +++ b/Classes/Transfer/ContentReleaseCleaner.php @@ -138,7 +138,7 @@ public function removeRelease( ContentReleaseIdentifier $contentReleaseIdentifierToRemove, RedisInstanceIdentifier $redisIdentifier, ContentReleaseLogger $contentReleaseLogger, - ) { + ): bool { $redis = $this->redisClientManager->getRedis($redisIdentifier); $currentRelease = $this->redisReleaseSwitchService->getCurrentRelease($redisIdentifier); @@ -146,12 +146,12 @@ public function removeRelease( $contentReleaseLogger->error( 'We did not find a current release in Content Store; so to be safe, we will NOT remove anything.', ); - return; + return false; } if ($currentRelease->equals($contentReleaseIdentifierToRemove)) { $contentReleaseLogger->error('Release to be removed is currently active, thus we do not remove it.'); - return; + return false; } $redisKeyPostfixesForEachRelease = RedisKeyPostfixesForEachRelease::fromArray($this->redisKeyPostfixesForEachReleaseConfiguration); @@ -174,5 +174,6 @@ public function removeRelease( } $redis->zRem('contentStore:registeredReleases', $contentReleaseIdentifierToRemove->getIdentifier()); + return true; } } diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index cbca374..5119372 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1566,11 +1566,6 @@ parameters: count: 1 path: Classes/Transfer/ContentReleaseCleaner.php - - - message: '#^Method Flowpack\\DecoupledContentStore\\Transfer\\ContentReleaseCleaner\:\:removeRelease\(\) has no return type specified\.$#' - identifier: missingType.return - count: 1 - path: Classes/Transfer/ContentReleaseCleaner.php - message: '#^Only booleans are allowed in a negated boolean, Flowpack\\DecoupledContentStore\\Core\\Domain\\ValueObject\\ContentReleaseIdentifier\|null given\.$#'