Neos.ContentRepository/Classes/Command/NodeCommandControllerPlugin.php
protected function repairShadowNodes($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType = null)
    {
        /** @var Workspace $workspace */
        $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
        if ($workspace->getBaseWorkspace() === null) {
            $this->dispatch(self::EVENT_NOTICE, sprintf('Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.', $workspaceName));
            return;
        }

        $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with missing shadow nodes ...');
        $newShadowNodes = $this->findMissingShadowNodesInWorkspace($workspace, $nodeType);
        if ($newShadowNodes === []) {
            return;
        }
        $numberOfNewShadowNodes = count($newShadowNodes);

        $taskDescription = sprintf('Add <i>%d</i> missing shadow node%s', $numberOfNewShadowNodes, $numberOfNewShadowNodes > 1 ? 's' : '');
        $taskClosure = function () use ($newShadowNodes) {
            /** @var NodeData $nodeData */
            foreach ($newShadowNodes as list('nodeData' => $nodeData, 'shadowPath' => $shadowPath)) {
                $nodeData->createShadow($shadowPath);
            }
            $this->persistenceManager->persistAll();
        };
        $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure);
    }
protected function repairShadowNodes($workspaceName, /** @noinspection PhpUnusedParameterInspection */$dryRun, NodeType $nodeType = null)
    {
        /** @var Workspace $workspace */
        $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
        if ($workspace->getBaseWorkspace() === null) {
            $this->dispatch(self::EVENT_NOTICE, sprintf('Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.', $workspaceName));
            return;
        }

        $this->dispatch(self::EVENT_NOTICE, 'Checking for nodes with missing shadow nodes ...');
        $newShadowNodes = $this->findMissingShadowNodesInWorkspace($workspace, $nodeType);
        if ($newShadowNodes === []) {
            return;
        }
        $numberOfNewShadowNodes = count($newShadowNodes);

        $taskDescription = sprintf('Add <i>%d</i> missing shadow node%s', $numberOfNewShadowNodes, $numberOfNewShadowNodes > 1 ? 's' : '');
        $taskClosure = function () use ($newShadowNodes) {
            /** @var NodeData $nodeData */
            foreach ($newShadowNodes as list('nodeData' => $nodeData, 'shadowPath' => $shadowPath)) {
                $nodeData->createShadow($shadowPath);
            }
            $this->persistenceManager->persistAll();
        };
        $this->dispatch(self::EVENT_TASK, $taskDescription, $taskClosure);
    }
protected function repairShadowNodes ( $ workspaceName , /** @noinspection PhpUnusedParameterInspection */ $ dryRun , NodeType $ nodeType = null ) { /** @var Workspace $workspace */ $ workspace = $ this -> workspaceRepository -> findByIdentifier ( $ workspaceName ) ; if ( $ workspace -> getBaseWorkspace ( ) === null ) { $ this -> dispatch ( self :: EVENT_NOTICE , sprintf ( 'Repairing base workspace "<i>%s</i>", therefore skipping check for shadow nodes.' , $ workspaceName ) ) ; return ; } $ this -> dispatch ( self :: EVENT_NOTICE , 'Checking for nodes with missing shadow nodes ...' ) ; $ newShadowNodes = $ this -> findMissingShadowNodesInWorkspace ( $ workspace , $ nodeType ) ; if ( $ newShadowNodes === [ ] ) { return ; } $ numberOfNewShadowNodes = count ( $ newShadowNodes ) ; $ taskDescription = sprintf ( 'Add <i>%d</i> missing shadow node%s' , $ numberOfNewShadowNodes , $ numberOfNewShadowNodes > 1 ? 's' : '' ) ; $ taskClosure = function ( ) use ( $ newShadowNodes ) { /** @var NodeData $nodeData */ foreach ( $ newShadowNodes as list ( 'nodeData' => $ nodeData , 'shadowPath' => $ shadowPath ) ) { $ nodeData -> createShadow ( $ shadowPath ) ; } $ this -> persistenceManager -> persistAll ( ) ; } ; $ this -> dispatch ( self :: EVENT_TASK , $ taskDescription , $ taskClosure ) ; }
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 (unused)
@param NodeType $nodeType This argument will be ignored
@return void
Repair nodes whose shadow nodes are missing