From a209f3a02289f6025709d2577933e47673ea42d7 Mon Sep 17 00:00:00 2001 From: Wilhelm Behncke Date: Sun, 21 May 2023 17:03:01 +0200 Subject: [PATCH 1/2] BUGFIX: Add base workspace to `nodeDiscarded` signal --- .../Classes/Domain/Service/PublishingService.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php b/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php index 0c352dea3df..c0c8163cc7a 100644 --- a/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php +++ b/Neos.ContentRepository/Classes/Domain/Service/PublishingService.php @@ -166,7 +166,8 @@ public function discardNode(NodeInterface $node) */ protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNodeIdentifiers = []) { - if ($node->getWorkspace()->getBaseWorkspace() === null) { + $baseWorkspace = $node->getWorkspace()->getBaseWorkspace(); + if ($baseWorkspace === null) { throw new WorkspaceException('Nodes in a workspace without a base workspace cannot be discarded.', 1395841899); } if ($node->getPath() === '/') { @@ -197,7 +198,7 @@ protected function doDiscardNode(NodeInterface $node, array &$alreadyDiscardedNo } $this->nodeDataRepository->remove($node); - $this->emitNodeDiscarded($node); + $this->emitNodeDiscarded($node, $baseWorkspace); } /** @@ -274,11 +275,12 @@ public function emitNodePublished(NodeInterface $node, Workspace $targetWorkspac * The signal emits the node that has been discarded. * * @param NodeInterface $node + * @param Workspace|null $baseWorkspace * @return void * @Flow\Signal * @api */ - public function emitNodeDiscarded(NodeInterface $node) + public function emitNodeDiscarded(NodeInterface $node, ?Workspace $baseWorkspace = null) { } From c99cd8b1b609d60fd6775f4dd16f381664dc0f63 Mon Sep 17 00:00:00 2001 From: Wilhelm Behncke Date: Tue, 23 May 2023 16:38:10 +0200 Subject: [PATCH 2/2] BUGFIX: Ensure that ContentCacheFlusher registers all tags for actual node variant in workspace --- .../Classes/Fusion/Cache/ContentCacheFlusher.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php index f2359b327cd..a50b8c19857 100644 --- a/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php +++ b/Neos.Neos/Classes/Fusion/Cache/ContentCacheFlusher.php @@ -157,6 +157,20 @@ protected function addTagToFlush(string $tag, string $message = ''): void protected function registerAllTagsToFlushForNodeInWorkspace(NodeInterface $node, Workspace $workspace): void { + // Ensure that we're dealing with the variant of the given node that actually + // lives in the given workspace + if ($node->getWorkspace()->getName() !== $workspace->getName()) { + $workspaceContext = $this->contextFactory->create( + array_merge( + $node->getContext()->getProperties(), + ['workspaceName' => $workspace->getName()] + ) + ); + $node = $workspaceContext->getNodeByIdentifier($node->getIdentifier()); + if ($node === null) { + return; + } + } $nodeIdentifier = $node->getIdentifier(); if (!array_key_exists($workspace->getName(), $this->workspacesToFlush) || is_array($this->workspacesToFlush[$workspace->getName()]) === false) {