public function removeNodesWithInvalidDimensions($workspaceName, $dryRun)
{
$this->output->outputLine('Checking for nodes with invalid dimensions ...');
$allowedDimensionCombinations = $this->contentDimensionCombinator->getAllAllowedCombinations();
$nodesArray = $this->collectNodesWithInvalidDimensions($workspaceName, $allowedDimensionCombinations);
if ($nodesArray === []) {
return;
}
if (!$dryRun) {
$self = $this;
$this->output->outputLine();
$this->output->outputLine('Nodes with invalid dimension values found.' . PHP_EOL . 'You might solve this by migrating them to your current dimension configuration or by removing them.');
$this->askBeforeExecutingTask(sprintf('Do you want to remove %s node%s with invalid dimensions now?', count($nodesArray), count($nodesArray) > 1 ? 's' : ''), function () use($self, $nodesArray, $workspaceName) {
foreach ($nodesArray as $nodeArray) {
$self->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']);
}
$self->output->outputLine('Removed %s node%s with invalid dimension values.', array(count($nodesArray), count($nodesArray) > 1 ? 's' : ''));
});
} else {
$this->output->outputLine('Found %s node%s with invalid dimension values to be removed.', array(count($nodesArray), count($nodesArray) > 1 ? 's' : ''));
}
$this->output->outputLine();
}