Neos.ContentRepository/Classes/Command/NodeCommandController.php
public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null)
    {
        $this->pluginConfigurations = self::detectPlugins($this->objectManager);

        /** @noinspection PhpUndefinedMethodInspection */
        if ($this->workspaceRepository->countByName($workspace) === 0) {
            $this->outputLine('Workspace "%s" does not exist', [$workspace]);
            exit(1);
        }

        if ($nodeType !== null) {
            try {
                $nodeType = $this->nodeTypeManager->getNodeType($nodeType);
            } catch (NodeTypeNotFoundException $e) {
                $this->outputLine('<error>Node type "%s" does not exist</error>', [$nodeType]);
                $this->quit(1);
                return;
            }
        }

        if ($dryRun) {
            $this->outputLine('Dry run, not committing any changes.');
        }

        if (!$cleanup) {
            $this->outputLine('Omitting cleanup tasks.');
        }

        foreach ($this->pluginConfigurations as $pluginConfiguration) {
            /** @var NodeCommandControllerPluginInterface $plugin */
            $plugin = $pluginConfiguration['object'];
            $this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
            $this->outputLine();
            if ($plugin instanceof EventDispatchingNodeCommandControllerPluginInterface) {
                $this->attachPluginEventHandlers($plugin, $dryRun);
            }
            /** @noinspection PhpMethodParametersCountMismatchInspection */
            $plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup, $skip, $only);
            $this->outputLine();
        }

        if ($dryRun) {
            $this->outputLine('Node repair dry run finished.');
        } else {
            $this->outputLine('<success>Node repair finished.</success>');
        }
    }
public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true, $skip = null, $only = null)
    {
        $this->pluginConfigurations = self::detectPlugins($this->objectManager);

        /** @noinspection PhpUndefinedMethodInspection */
        if ($this->workspaceRepository->countByName($workspace) === 0) {
            $this->outputLine('Workspace "%s" does not exist', [$workspace]);
            exit(1);
        }

        if ($nodeType !== null) {
            try {
                $nodeType = $this->nodeTypeManager->getNodeType($nodeType);
            } catch (NodeTypeNotFoundException $e) {
                $this->outputLine('<error>Node type "%s" does not exist</error>', [$nodeType]);
                $this->quit(1);
                return;
            }
        }

        if ($dryRun) {
            $this->outputLine('Dry run, not committing any changes.');
        }

        if (!$cleanup) {
            $this->outputLine('Omitting cleanup tasks.');
        }

        foreach ($this->pluginConfigurations as $pluginConfiguration) {
            /** @var NodeCommandControllerPluginInterface $plugin */
            $plugin = $pluginConfiguration['object'];
            $this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
            $this->outputLine();
            if ($plugin instanceof EventDispatchingNodeCommandControllerPluginInterface) {
                $this->attachPluginEventHandlers($plugin, $dryRun);
            }
            /** @noinspection PhpMethodParametersCountMismatchInspection */
            $plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup, $skip, $only);
            $this->outputLine();
        }

        if ($dryRun) {
            $this->outputLine('Node repair dry run finished.');
        } else {
            $this->outputLine('<success>Node repair finished.</success>');
        }
    }
public function repairCommand ( $ nodeType = null , $ workspace = 'live' , $ dryRun = false , $ cleanup = true , $ skip = null , $ only = null ) { $ this -> pluginConfigurations = self :: detectPlugins ( $ this -> objectManager ) ; /** @noinspection PhpUndefinedMethodInspection */ if ( $ this -> workspaceRepository -> countByName ( $ workspace ) === 0 ) { $ this -> outputLine ( 'Workspace "%s" does not exist' , [ $ workspace ] ) ; exit ( 1 ) ; } if ( $ nodeType !== null ) { try { $ nodeType = $ this -> nodeTypeManager -> getNodeType ( $ nodeType ) ; } catch ( NodeTypeNotFoundException $ e ) { $ this -> outputLine ( '<error>Node type "%s" does not exist</error>' , [ $ nodeType ] ) ; $ this -> quit ( 1 ) ; return ; } } if ( $ dryRun ) { $ this -> outputLine ( 'Dry run, not committing any changes.' ) ; } if ( ! $ cleanup ) { $ this -> outputLine ( 'Omitting cleanup tasks.' ) ; } foreach ( $ this -> pluginConfigurations as $ pluginConfiguration ) { /** @var NodeCommandControllerPluginInterface $plugin */ $ plugin = $ pluginConfiguration [ 'object' ] ; $ this -> outputLine ( '<b>' . $ plugin -> getSubCommandShortDescription ( 'repair' ) . '</b>' ) ; $ this -> outputLine ( ) ; if ( $ plugin instanceof EventDispatchingNodeCommandControllerPluginInterface ) { $ this -> attachPluginEventHandlers ( $ plugin , $ dryRun ) ; } /** @noinspection PhpMethodParametersCountMismatchInspection */ $ plugin -> invokeSubCommand ( 'repair' , $ this -> output , $ nodeType , $ workspace , $ dryRun , $ cleanup , $ skip , $ only ) ; $ this -> outputLine ( ) ; } if ( $ dryRun ) { $ this -> outputLine ( 'Node repair dry run finished.' ) ; } else { $ this -> outputLine ( '<success>Node repair finished.</success>' ) ; } }
Repair inconsistent nodes

This command analyzes and repairs the node tree structure and individual nodes
based on the current node type configuration.

It is possible to execute only one or more specific checks by providing the <b>--skip</b>
or <b>--only</b> option. See the full description of checks further below for possible check
identifiers.

The following checks will be performed:

{pluginDescriptions}
<b>Examples:</b>

./flow node:repair

./flow node:repair --node-type Neos.NodeTypes:Page

./flow node:repair --workspace user-robert --only removeOrphanNodes,removeNodesWithInvalidDimensions

./flow node:repair --skip removeUndefinedProperties

@param string $nodeType Node type name, if empty update all declared node types
@param string $workspace Workspace name, default is 'live'
@param boolean $dryRun Don't do anything, but report actions
@param boolean $cleanup If false, cleanup tasks are skipped
@param string $skip Skip the given check or checks (comma separated)
@param string $only Only execute the given check or checks (comma separated)
@return void
@throws StopActionException
Repair inconsistent nodes