public function removeNodesWithInvalidWorkspace($workspaceName, $dryRun)
{
$this->output->outputLine('Checking for nodes with invalid workspace ...');
$nodesArray = $this->collectNodesWithInvalidWorkspace();
if ($nodesArray === []) {
return;
}
if (!$dryRun) {
$self = $this;
$this->output->outputLine();
$this->output->outputLine('Nodes with invalid workspace found.');
$this->askBeforeExecutingTask(sprintf('Do you want to remove %s node%s with invalid workspaces now?', count($nodesArray), count($nodesArray) > 1 ? 's' : ''), function () use($self, $nodesArray) {
foreach ($nodesArray as $nodeArray) {
$self->removeNode($nodeArray['identifier'], $nodeArray['dimensionsHash']);
}
$self->output->outputLine('Removed %s node%s referring to an invalid workspace.', array(count($nodesArray), count($nodesArray) > 1 ? 's' : ''));
});
} else {
$this->output->outputLine('Found %s node%s referring to an invalid workspace to be removed.', array(count($nodesArray), count($nodesArray) > 1 ? 's' : ''));
}
$this->output->outputLine();
}