/**
  * Remove dimensions on nodes "/" and "/sites"
  *
  * This empties the content dimensions on those nodes, so when traversing via the Node API from the root node,
  * the nodes below "/sites" are always reachable.
  *
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 public function removeContentDimensionsFromRootAndSitesNode($workspaceName, $dryRun)
 {
     $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
     $rootNodes = $this->nodeDataRepository->findByPath('/', $workspace);
     $sitesNodes = $this->nodeDataRepository->findByPath('/sites', $workspace);
     $this->output->outputLine('Checking for root and site nodes with content dimensions set ...');
     /** @var \Neos\ContentRepository\Domain\Model\NodeData $rootNode */
     foreach ($rootNodes as $rootNode) {
         if ($rootNode->getDimensionValues() !== []) {
             if ($dryRun === false) {
                 $rootNode->setDimensions([]);
                 $this->nodeDataRepository->update($rootNode);
                 $this->output->outputLine('Removed content dimensions from root node');
             } else {
                 $this->output->outputLine('Found root node with content dimensions set.');
             }
         }
     }
     /** @var \Neos\ContentRepository\Domain\Model\NodeData $sitesNode */
     foreach ($sitesNodes as $sitesNode) {
         if ($sitesNode->getDimensionValues() !== []) {
             if ($dryRun === false) {
                 $sitesNode->setDimensions([]);
                 $this->nodeDataRepository->update($sitesNode);
                 $this->output->outputLine('Removed content dimensions from node "/sites"');
             } else {
                 $this->output->outputLine('Found node "/sites"');
             }
         }
     }
 }
 /**
  * Repair nodes whose shadow nodes are missing
  *
  * This check searches for nodes which have a corresponding node in one of the base workspaces,
  * have different node paths, but don't have a corresponding shadow node with a "movedto" value.
  *
  * @param string $workspaceName Currently ignored
  * @param boolean $dryRun Simulate?
  * @param NodeType $nodeType This argument will be ignored
  * @return void
  */
 protected function repairShadowNodes($workspaceName, $dryRun, NodeType $nodeType = null)
 {
     /** @var Workspace $workspace */
     $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
     if ($workspace->getBaseWorkspace() === null) {
         $this->output->outputLine('Repairing base workspace "%s", therefore skipping check for shadow nodes.', [$workspaceName]);
         $this->output->outputLine();
         return;
     }
     $this->output->outputLine('Checking for nodes with missing shadow nodes ...');
     $fixedShadowNodes = $this->fixShadowNodesInWorkspace($workspace, $nodeType);
     $this->output->outputLine('%s %s node%s with missing shadow nodes.', [$dryRun ? 'Would repair' : 'Repaired', $fixedShadowNodes, $fixedShadowNodes !== 1 ? 's' : '']);
     $this->output->outputLine();
 }
 /**
  * @test
  */
 public function outputReplacesArgumentsInGivenString()
 {
     $this->mockConsoleOutput->expects($this->once())->method('output')->with('%2$s %1$s', ['text', 'some']);
     $this->commandController->_call('output', '%2$s %1$s', ['text', 'some']);
 }
 /**
  * Formats the given text to fit into MAXIMUM_LINE_LENGTH and outputs it to the
  * console window
  *
  * @param string $text Text to output
  * @param array $arguments Optional arguments to use for sprintf
  * @param integer $leftPadding The number of spaces to use for indentation
  * @return void
  * @see outputLine()
  * @api
  */
 protected function outputFormatted($text = '', array $arguments = [], $leftPadding = 0)
 {
     $this->output->outputFormatted($text, $arguments, $leftPadding);
 }