class RedispatchHook implements InitializeHookInterface, ConfigAwareInterface, SiteAliasManagerAwareInterface (View source)

The RedispatchHook is installed as an init hook that runs before all commands. If the commandline contains an alias or a site specification that points at a remote machine, then we will stop execution of the current command and instead run the command remotely.

Traits

SiteAliasManagerAwareTrait
ConfigAwareTrait

Properties

protected ProcessManager $processManager

Methods

getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct(ProcessManager $processManager)

No description

initialize(InputInterface $input, AnnotationData $annotationData)

Check to see if it is necessary to redispatch to a remote site.

redispatchIfRemote(InputInterface $input)

Check to see if the target of the command is remote. Call redispatch if it is.

redispatch(InputInterface $input)

Called from RemoteCommandProxy::execute() to run remote commands.

alterArgsForRedispatch(array $redispatchArgs)

Remove anything that is not necessary for the remote side.

exitEarly($exit_code)

Abort the current execution without causing distress to our shutdown handler.

Details

DrushConfig getConfig()

Replaces same method in ConfigAwareTrait in order to provide a DrushConfig as return type. Helps with IDE completion.

__construct(ProcessManager $processManager)

Parameters

ProcessManager $processManager

initialize(InputInterface $input, AnnotationData $annotationData)

Check to see if it is necessary to redispatch to a remote site.

We do not redispatch to local sites here; usually, local sites may simply be selected and require no redispatch. When a local redispatch is needed, it happens in the RedispatchToSiteLocal class.

Parameters

InputInterface $input
AnnotationData $annotationData

redispatchIfRemote(InputInterface $input)

Check to see if the target of the command is remote. Call redispatch if it is.

Parameters

InputInterface $input

redispatch(InputInterface $input)

Called from RemoteCommandProxy::execute() to run remote commands.

Parameters

InputInterface $input

protected alterArgsForRedispatch(array $redispatchArgs)

Remove anything that is not necessary for the remote side.

At the moment this is limited to configuration options provided via -D.

Parameters

array $redispatchArgs

protected exitEarly($exit_code)

Abort the current execution without causing distress to our shutdown handler.

Parameters

$exit_code