class NodeCommandControllerPlugin implements EventDispatchingNodeCommandControllerPluginInterface (View source)

A plugin for the ContentRepository NodeCommandController which adds some tasks to the node:repair command:

  • adding missing URI segments
  • removing dimensions on nodes / and /sites

Properties

protected ContextFactoryInterface $contextFactory
protected WorkspaceRepository $workspaceRepository
protected ContentDimensionRepository $contentDimensionRepository
protected NodeDataRepository $nodeDataRepository
protected ContentDimensionCombinator $dimensionCombinator
protected NodeUriPathSegmentGenerator $nodeUriPathSegmentGenerator
protected ConsoleOutput deprecated $output
protected PersistenceManagerInterface $persistenceManager
protected Closure[] $eventCallbacks

Callbacks to be invoked when an event is triggered

Methods

static string
getSubCommandShortDescription(string $controllerCommandName)

Returns a short description

static string
getSubCommandDescription(string $controllerCommandName)

Returns a piece of description for the specific task the plugin solves for the specified command

void
invokeSubCommand(string $controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, string $workspaceName = 'live', bool $dryRun = false, bool $cleanup = true, string $skip = null, string $only = null)

A method which runs the task implemented by the plugin for the given command

void
createMissingSitesNode()

Creates the /sites node if it is missing.

void
generateUriPathSegments(string $workspaceName, bool $dryRun)

Generate missing URI path segments

void
generateUriPathSegmentsForNode(NodeInterface $node, bool $dryRun)

Traverses through the tree starting at the given root node and sets the uriPathSegment property derived from the node label.

void
removeContentDimensionsFromRootAndSitesNode(string $workspaceName)

Remove dimensions on nodes "/" and "/sites"

createContext(string $workspaceName, array $dimensions)

Creates a content context for given workspace and language identifiers

void
on(string $eventIdentifier, Closure $callback)

Attaches a new event handler

void
dispatch(string $eventIdentifier, array ...$eventPayload)

Trigger a custom event

Details

static string getSubCommandShortDescription(string $controllerCommandName)

Returns a short description

Parameters

string $controllerCommandName

Name of the command in question, for example "repair"

Return Value

string

A brief description / summary for the task this plugin is going to do

static string getSubCommandDescription(string $controllerCommandName)

Returns a piece of description for the specific task the plugin solves for the specified command

Parameters

string $controllerCommandName

Name of the command in question, for example "repair"

Return Value

string

A piece of text to be included in the overall description of the node:xy command

void invokeSubCommand(string $controllerCommandName, ConsoleOutput $output, NodeType $nodeType = null, string $workspaceName = 'live', bool $dryRun = false, bool $cleanup = true, string $skip = null, string $only = null)

A method which runs the task implemented by the plugin for the given command

Parameters

string $controllerCommandName

Name of the command in question, for example "repair"

ConsoleOutput $output

An instance of ConsoleOutput which can be used for output or dialogues

NodeType $nodeType

Only handle this node type (if specified)

string $workspaceName

Only handle this workspace (if specified)

bool $dryRun

If true, don't do any changes, just simulate what you would do

bool $cleanup

If false, cleanup tasks are skipped

string $skip

Skip the given check or checks (comma separated)

string $only

Only execute the given check or checks (comma separated)

Return Value

void

protected void createMissingSitesNode()

Creates the /sites node if it is missing.

Return Value

void

Exceptions

IllegalObjectTypeException

void generateUriPathSegments(string $workspaceName, bool $dryRun)

Generate missing URI path segments

This generates URI path segment properties for all document nodes which don't have a path segment set yet.

Parameters

string $workspaceName
bool $dryRun

Return Value

void

Exceptions

Exception
NodeException
Exception

protected void generateUriPathSegmentsForNode(NodeInterface $node, bool $dryRun)

Traverses through the tree starting at the given root node and sets the uriPathSegment property derived from the node label.

Parameters

NodeInterface $node

The node where the traversal starts

bool $dryRun

Return Value

void

Exceptions

NodeException
Exception

void removeContentDimensionsFromRootAndSitesNode(string $workspaceName)

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.

Parameters

string $workspaceName

Return Value

void

protected Context createContext(string $workspaceName, array $dimensions)

Creates a content context for given workspace and language identifiers

Parameters

string $workspaceName
array $dimensions

Return Value

Context

void on(string $eventIdentifier, Closure $callback)

Attaches a new event handler

Parameters

string $eventIdentifier

one of the EVENT_* constants

Closure $callback

a closure to be invoked when the corresponding event was triggered

Return Value

void

protected void dispatch(string $eventIdentifier, array ...$eventPayload)

Trigger a custom event

Parameters

string $eventIdentifier

one of the EVENT_* constants

array ...$eventPayload

optional arguments to be passed to the handler closure

Return Value

void