PHP Class Neos\ContentRepository\Command\NodeCommandControllerPlugin

Inheritance: implements Neos\ContentRepository\Command\NodeCommandControllerPluginInterface
Datei anzeigen Open project: neos/neos-development-collection

Protected Properties

Property Type Description
$contentDimensionCombinator Neos\ContentRepository\Domain\Service\ContentDimensionCombinator
$contextFactory Neos\ContentRepository\Domain\Service\ContextFactoryInterface
$entityManager Doctrine\Common\Persistence\ObjectManager ..
$nodeDataRepository Neos\ContentRepository\Domain\Repository\NodeDataRepository
$nodeFactory Neos\ContentRepository\Domain\Factory\NodeFactory
$nodeTypeManager Neos\ContentRepository\Domain\Service\NodeTypeManager
$output Neos\Flow\Cli\ConsoleOutput
$persistenceManager Neos\Flow\Persistence\PersistenceManagerInterface
$pluginConfigurations array
$propertyMapper Neos\Flow\Property\PropertyMapper
$workspaceRepository Neos\ContentRepository\Domain\Repository\WorkspaceRepository

Public Methods

Method Description
addMissingDefaultValues ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void Performs checks for unset properties that has default values and sets them if necessary.
addMissingDefaultValuesByNodeType ( NodeType $nodeType = null, string $workspaceName, boolean $dryRun ) : void Adds missing default values for the given node type
fixNodesWithInconsistentIdentifier ( string $workspaceName, boolean $dryRun ) : void Detect and fix nodes in non-live workspaces whose identifier does not match their corresponding node in the live workspace.
getSubCommandDescription ( string $controllerCommandName ) : string Returns a piece of description for the specific task the plugin solves for the specified command
getSubCommandShortDescription ( string $controllerCommandName ) : string Returns a short description
invokeSubCommand ( string $controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, string $workspaceName = 'live', boolean $dryRun = false, boolean $cleanup = true, string $skip = null, string $only = null ) : void A method which runs the task implemented by the plugin for the given command
removeBrokenEntityReferences ( string $workspaceName, boolean $dryRun ) : void Remove broken entity references
removeNodesWithInvalidDimensions ( string $workspaceName, boolean $dryRun ) : void Remove nodes with invalid dimension values
removeNodesWithInvalidWorkspace ( string $workspaceName, boolean $dryRun ) : void Remove nodes with invalid workspace
removeUndefinedProperties ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void Performs checks for orphan nodes removes them if found.

Protected Methods

Method Description
askBeforeExecutingTask ( string $question, Closure $task ) : void
collectNodesWithInvalidDimensions ( string $workspaceName, array $allowedDimensionCombinations ) : array Collects all nodes of the given node type which have dimension values not fitting to the current dimension configuration.
collectNodesWithInvalidWorkspace ( ) : array Collects all nodes of the given node type which refer to an invalid workspace configuration.
createChildNodesByNodeType ( NodeType $nodeType, string $workspaceName, boolean $dryRun ) : void Create missing child nodes for the given node type
createContext ( string $workspaceName, array $dimensions ) : Context Creates a content context for given workspace
createMissingChildNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void Performs checks for missing child nodes according to the node's auto-create configuration and creates them if necessary.
fixShadowNodesInWorkspace ( Workspace $workspace, boolean $dryRun, NodeType $nodeType = null ) : array Collects all nodes with missing shadow nodes
getNodeDataByNodeTypeAndWorkspace ( string $nodeType, string $workspaceName ) : array Retrieves all NodeData objects of a certain node type inside a given workspace.
removeAbstractAndUndefinedNodes ( string $workspaceName, boolean $dryRun ) : void Performs checks for nodes with abstract or undefined node types and removes them if found.
removeDisallowedChildNodes ( string $workspaceName, boolean $dryRun ) : void Performs checks for disallowed child nodes according to the node's auto-create configuration and constraints and removes them if found.
removeNode ( string $nodeIdentifier, string $dimensionsHash ) Removes the specified node (exactly that one)
removeNodeAndChildNodesInWorkspaceByPath ( string $nodePath, string $workspaceName ) Removes all nodes with a specific path and their children in the given workspace.
removeOrphanNodes ( string $workspaceName, boolean $dryRun ) : void Performs checks for orphan nodes removes them if found.
reorderChildNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void Reorder child nodes according to the current position configuration of child nodes.
reorderChildNodesByNodeType ( string $workspaceName, boolean $dryRun, NodeType $nodeType ) : void Reorder child nodes for the given node type
repairShadowNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void Repair nodes whose shadow nodes are missing

Method Details

addMissingDefaultValues() public method

Performs checks for unset properties that has default values and sets them if necessary.
public addMissingDefaultValues ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void
$workspaceName string Name of the workspace to consider
$dryRun boolean Simulate?
$nodeType Neos\ContentRepository\Domain\Model\NodeType Only for this node type, if specified
return void

addMissingDefaultValuesByNodeType() public method

Adds missing default values for the given node type
public addMissingDefaultValuesByNodeType ( NodeType $nodeType = null, string $workspaceName, boolean $dryRun ) : void
$nodeType Neos\ContentRepository\Domain\Model\NodeType
$workspaceName string
$dryRun boolean
return void

askBeforeExecutingTask() protected method

protected askBeforeExecutingTask ( string $question, Closure $task ) : void
$question string
$task Closure
return void

collectNodesWithInvalidDimensions() protected method

Collects all nodes of the given node type which have dimension values not fitting to the current dimension configuration.
protected collectNodesWithInvalidDimensions ( string $workspaceName, array $allowedDimensionCombinations ) : array
$workspaceName string
$allowedDimensionCombinations array
return array

collectNodesWithInvalidWorkspace() protected method

Note: due to the foreign key constraints in the database, there actually never should be any node with n.workspace of a non-existing workspace because if that workspace does not exist anymore, the value would turn NULL. But the query covers this nevertheless. Better safe than sorry.

createChildNodesByNodeType() protected method

Create missing child nodes for the given node type
protected createChildNodesByNodeType ( NodeType $nodeType, string $workspaceName, boolean $dryRun ) : void
$nodeType Neos\ContentRepository\Domain\Model\NodeType
$workspaceName string
$dryRun boolean
return void

createContext() protected method

Creates a content context for given workspace
protected createContext ( string $workspaceName, array $dimensions ) : Context
$workspaceName string
$dimensions array
return Neos\ContentRepository\Domain\Service\Context

createMissingChildNodes() protected method

Performs checks for missing child nodes according to the node's auto-create configuration and creates them if necessary.
protected createMissingChildNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void
$workspaceName string Name of the workspace to consider
$dryRun boolean Simulate?
$nodeType Neos\ContentRepository\Domain\Model\NodeType Only for this node type, if specified
return void

fixNodesWithInconsistentIdentifier() public method

Detect and fix nodes in non-live workspaces whose identifier does not match their corresponding node in the live workspace.
public fixNodesWithInconsistentIdentifier ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string This argument will be ignored
$dryRun boolean Simulate?
return void

fixShadowNodesInWorkspace() protected method

Collects all nodes with missing shadow nodes
protected fixShadowNodesInWorkspace ( Workspace $workspace, boolean $dryRun, NodeType $nodeType = null ) : array
$workspace Neos\ContentRepository\Domain\Model\Workspace
$dryRun boolean
$nodeType Neos\ContentRepository\Domain\Model\NodeType
return array

getNodeDataByNodeTypeAndWorkspace() protected method

Shadow nodes are excluded, because they will be published when publishing the moved node.
protected getNodeDataByNodeTypeAndWorkspace ( string $nodeType, string $workspaceName ) : array
$nodeType string
$workspaceName string
return array

getSubCommandDescription() public static method

Returns a piece of description for the specific task the plugin solves for the specified command
public static getSubCommandDescription ( string $controllerCommandName ) : string
$controllerCommandName string Name of the command in question, for example "repair"
return string A piece of text to be included in the overall description of the node:xy command

getSubCommandShortDescription() public static method

Returns a short description
public static getSubCommandShortDescription ( string $controllerCommandName ) : string
$controllerCommandName string Name of the command in question, for example "repair"
return string A piece of text to be included in the overall description of the node:xy command

invokeSubCommand() public method

A method which runs the task implemented by the plugin for the given command
public invokeSubCommand ( string $controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, string $workspaceName = 'live', boolean $dryRun = false, boolean $cleanup = true, string $skip = null, string $only = null ) : void
$controllerCommandName string Name of the command in question, for example "repair"
$output Neos\Flow\Cli\ConsoleOutput An instance of ConsoleOutput which can be used for output or dialogues
$nodeType Neos\ContentRepository\Domain\Model\NodeType Only handle this node type (if specified)
$workspaceName string Only handle this workspace (if specified)
$dryRun boolean If TRUE, don't do any changes, just simulate what you would do
$cleanup boolean If FALSE, cleanup tasks are skipped
$skip string Skip the given check or checks (comma separated)
$only string Only execute the given check or checks (comma separated)
return void

removeAbstractAndUndefinedNodes() protected method

Performs checks for nodes with abstract or undefined node types and removes them if found.
protected removeAbstractAndUndefinedNodes ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string
$dryRun boolean Simulate?
return void

removeBrokenEntityReferences() public method

This removes references from nodes to entities which don't exist anymore.
public removeBrokenEntityReferences ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string
$dryRun boolean
return void

removeDisallowedChildNodes() protected method

Performs checks for disallowed child nodes according to the node's auto-create configuration and constraints and removes them if found.
protected removeDisallowedChildNodes ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string
$dryRun boolean Simulate?
return void

removeNode() protected method

Removes the specified node (exactly that one)
protected removeNode ( string $nodeIdentifier, string $dimensionsHash )
$nodeIdentifier string
$dimensionsHash string

removeNodeAndChildNodesInWorkspaceByPath() protected method

Removes all nodes with a specific path and their children in the given workspace.
protected removeNodeAndChildNodesInWorkspaceByPath ( string $nodePath, string $workspaceName )
$nodePath string
$workspaceName string

removeNodesWithInvalidDimensions() public method

This removes nodes which have dimension values not fitting to the current dimension configuration
public removeNodesWithInvalidDimensions ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string Name of the workspace to consider
$dryRun boolean Simulate?
return void

removeNodesWithInvalidWorkspace() public method

This removes nodes which refer to a workspace which does not exist.
public removeNodesWithInvalidWorkspace ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string This argument will be ignored
$dryRun boolean Simulate?
return void

removeOrphanNodes() protected method

Performs checks for orphan nodes removes them if found.
protected removeOrphanNodes ( string $workspaceName, boolean $dryRun ) : void
$workspaceName string
$dryRun boolean Simulate?
return void

removeUndefinedProperties() public method

Performs checks for orphan nodes removes them if found.
public removeUndefinedProperties ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void
$workspaceName string
$dryRun boolean Simulate?
$nodeType Neos\ContentRepository\Domain\Model\NodeType Only for this node type, if specified
return void

reorderChildNodes() protected method

Reorder child nodes according to the current position configuration of child nodes.
protected reorderChildNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void
$workspaceName string Name of the workspace to consider
$dryRun boolean Simulate?
$nodeType Neos\ContentRepository\Domain\Model\NodeType Only for this node type, if specified
return void

reorderChildNodesByNodeType() protected method

Reorder child nodes for the given node type
protected reorderChildNodesByNodeType ( string $workspaceName, boolean $dryRun, NodeType $nodeType ) : void
$workspaceName string
$dryRun boolean
$nodeType Neos\ContentRepository\Domain\Model\NodeType
return void

repairShadowNodes() protected method

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.
protected repairShadowNodes ( string $workspaceName, boolean $dryRun, NodeType $nodeType = null ) : void
$workspaceName string Currently ignored
$dryRun boolean Simulate?
$nodeType Neos\ContentRepository\Domain\Model\NodeType This argument will be ignored
return void

Property Details

$contentDimensionCombinator protected_oe property

protected ContentDimensionCombinator,Neos\ContentRepository\Domain\Service $contentDimensionCombinator
return Neos\ContentRepository\Domain\Service\ContentDimensionCombinator

$contextFactory protected_oe property

protected ContextFactoryInterface,Neos\ContentRepository\Domain\Service $contextFactory
return Neos\ContentRepository\Domain\Service\ContextFactoryInterface

$entityManager protected_oe property

..
protected ObjectManager,Doctrine\Common\Persistence $entityManager
return Doctrine\Common\Persistence\ObjectManager

$nodeDataRepository protected_oe property

protected NodeDataRepository,Neos\ContentRepository\Domain\Repository $nodeDataRepository
return Neos\ContentRepository\Domain\Repository\NodeDataRepository

$nodeFactory protected_oe property

protected NodeFactory,Neos\ContentRepository\Domain\Factory $nodeFactory
return Neos\ContentRepository\Domain\Factory\NodeFactory

$nodeTypeManager protected_oe property

protected NodeTypeManager,Neos\ContentRepository\Domain\Service $nodeTypeManager
return Neos\ContentRepository\Domain\Service\NodeTypeManager

$output protected_oe property

protected ConsoleOutput,Neos\Flow\Cli $output
return Neos\Flow\Cli\ConsoleOutput

$persistenceManager protected_oe property

protected PersistenceManagerInterface,Neos\Flow\Persistence $persistenceManager
return Neos\Flow\Persistence\PersistenceManagerInterface

$pluginConfigurations protected_oe property

protected array $pluginConfigurations
return array

$propertyMapper protected_oe property

protected PropertyMapper,Neos\Flow\Property $propertyMapper
return Neos\Flow\Property\PropertyMapper

$workspaceRepository protected_oe property

protected WorkspaceRepository,Neos\ContentRepository\Domain\Repository $workspaceRepository
return Neos\ContentRepository\Domain\Repository\WorkspaceRepository