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

Inflection trait for the site alias manager.

Properties

protected ConfigInterface $config from  ConfigAwareTrait
protected $siteAliasManager from  SiteAliasManagerAwareTrait

Methods

$this
setConfig(ConfigInterface $config)

Set the config management object.

ConfigInterface
getConfig()

Get the config management object.

static string
configPrefix()

Any class that uses ConfigAwareTrait SHOULD override this method , and define a prefix for its configuration items. This is usually done in a base class. When used, this method should return a string that ends with a "."; see BaseTask::configPrefix().

static 
configClassIdentifier($classname)

No description

static 
configPostfix()

No description

static 
configure(string $key, mixed $value, ConfigInterface|null $config = null)

No description

mixed|null
getConfigValue(string $key, mixed|null $default = null)

No description

__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.

never
redispatch(InputInterface $input)

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

array
alterArgsForRedispatch(array $redispatchArgs)

Remove anything that is not necessary for the remote side.

never
exitEarly(int $exit_code)

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

Details

$this setConfig(ConfigInterface $config)

Set the config management object.

Parameters

ConfigInterface $config

Return Value

$this

ConfigInterface getConfig()

Get the config management object.

Return Value

ConfigInterface

static protected string configPrefix()

Any class that uses ConfigAwareTrait SHOULD override this method , and define a prefix for its configuration items. This is usually done in a base class. When used, this method should return a string that ends with a "."; see BaseTask::configPrefix().

Return Value

string

static protected configClassIdentifier($classname)

No description

Parameters

$classname

static protected configPostfix()

No description

static configure(string $key, mixed $value, ConfigInterface|null $config = null)

No description

Parameters

string $key
mixed $value
ConfigInterface|null $config

protected mixed|null getConfigValue(string $key, mixed|null $default = null)

No description

Parameters

string $key
mixed|null $default

Return Value

mixed|null

setSiteAliasManager(SiteAliasManagerInterface $siteAliasManager)

No description

Parameters

SiteAliasManagerInterface $siteAliasManager

hasSiteAliasManager()

No description

__construct(ProcessManager $processManager)

No description

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

never redispatch(InputInterface $input)

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

Parameters

InputInterface $input

Return Value

never

protected array 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

Return Value

array

protected never exitEarly(int $exit_code)

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

Parameters

int $exit_code

Return Value

never