Skip to content

Commit

Permalink
TASK: Revert catchup hook adjustment to rely on NodeAggregateIds in…
Browse files Browse the repository at this point in the history
…stead of `NodeIdsToPublishOrDiscard`

... as a 3rd option the followup commit will just flush the full asset usage workspace!
  • Loading branch information
mhsdesign committed Nov 30, 2024
1 parent 1b6ab9d commit 16da882
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePoint;
use Neos\ContentRepository\Core\DimensionSpace\DimensionSpacePointSet;
use Neos\ContentRepository\Core\EventStore\EventInterface;
use Neos\ContentRepository\Core\Feature\Common\EmbedsContentStreamId;
use Neos\ContentRepository\Core\Feature\Common\EmbedsWorkspaceName;
use Neos\ContentRepository\Core\Feature\DimensionSpaceAdjustment\Event\DimensionSpacePointWasMoved;
use Neos\ContentRepository\Core\Feature\NodeCreation\Event\NodeAggregateWithNodeWasCreated;
Expand All @@ -27,7 +26,6 @@
use Neos\ContentRepository\Core\SharedModel\ContentRepository\ContentRepositoryId;
use Neos\ContentRepository\Core\SharedModel\Exception\WorkspaceDoesNotExist;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateId;
use Neos\ContentRepository\Core\SharedModel\Node\NodeAggregateIds;
use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName;
use Neos\EventStore\Model\EventEnvelope;
use Neos\Neos\AssetUsage\Service\AssetUsageIndexingService;
Expand Down Expand Up @@ -146,13 +144,18 @@ private function discardWorkspace(WorkspaceName $workspaceName): void
$this->assetUsageIndexingService->removeIndexForWorkspace($this->contentRepositoryId, $workspaceName);
}

private function discardNodes(WorkspaceName $workspaceName, NodeAggregateIds $nodeIds): void
private function discardNodes(WorkspaceName $workspaceName, NodeIdsToPublishOrDiscard $nodeIds): void
{
foreach ($nodeIds as $nodeId) {
$this->assetUsageIndexingService->removeAssetUsagesOfWorkspaceWithAllPropertiesInAllDimensions(
if (!$nodeId->dimensionSpacePoint) {
// NodeAggregateTypeWasChanged and NodeAggregateNameWasChanged don't impact asset usage
continue;
}
$this->assetUsageIndexingService->removeIndexForWorkspaceNameNodeAggregateIdAndDimensionSpacePoint(
$this->contentRepositoryId,
$workspaceName,
$nodeId,
$nodeId->nodeAggregateId,
$nodeId->dimensionSpacePoint
);
}
}
Expand Down
19 changes: 0 additions & 19 deletions Neos.Neos/Classes/AssetUsage/Domain/AssetUsageRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,6 @@ public function removeAssetUsagesOfWorkspaceWithAllProperties(
]);
}

public function removeAssetUsagesOfWorkspaceWithAllPropertiesInAllDimensions(
ContentRepositoryId $contentRepositoryId,
WorkspaceName $workspaceName,
NodeAggregateId $nodeAggregateId,
): void {
$sql = <<<SQL
DELETE FROM {$this->getTableName()}
WHERE contentrepositoryid = :contentRepositoryId
AND workspacename = :workspaceName
AND nodeAggregateId = :nodeAggregateId
SQL;

$this->dbal->executeStatement($sql, [
'contentRepositoryId' => $contentRepositoryId->value,
'workspaceName' => $workspaceName->value,
'nodeAggregateId' => $nodeAggregateId->value
]);
}

/**
* @param WorkspaceName[] $workspaceNames
*/
Expand Down
12 changes: 0 additions & 12 deletions Neos.Neos/Classes/AssetUsage/Service/AssetUsageIndexingService.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,18 +171,6 @@ public function removeIndexForWorkspaceNameNodeAggregateIdAndDimensionSpacePoint
);
}

public function removeAssetUsagesOfWorkspaceWithAllPropertiesInAllDimensions(
ContentRepositoryId $contentRepositoryId,
WorkspaceName $workspaceName,
NodeAggregateId $nodeAggregateId
): void {
$this->assetUsageRepository->removeAssetUsagesOfWorkspaceWithAllPropertiesInAllDimensions(
$contentRepositoryId,
$workspaceName,
$nodeAggregateId
);
}

public function removeIndexForWorkspace(
ContentRepositoryId $contentRepositoryId,
WorkspaceName $workspaceName
Expand Down

0 comments on commit 16da882

Please sign in to comment.