class Preflight (View source)

The Drush preflight determines what needs to be done for this request.

The preflight happens after Drush has loaded its autoload file, but prior to loading Drupal's autoload file and setting up the DI container.

  • Pre-parse commandline arguments
  • Read configuration .yml files
  • Determine the site to use

Properties

protected Environment $environment
protected PreflightVerify $verify
protected ConfigLocator $configLocator
protected DrushDrupalFinder $drupalFinder
protected PreflightArgs $preflightArgs
protected SiteAliasManager $aliasManager
protected PreflightLog $logger

Methods

__construct(Environment $environment, $verify = null, $configLocator = null, $preflightLog = null)

Preflight constructor

logger()

No description

void
setLogger(PreflightLog $logger)

No description

void
init()

Perform preliminary initialization. This mostly involves setting up legacy systems.

array
remapOptions()

Remapping table for arguments. Anything found in a key here will be converted to the corresponding value entry.

array
remapCommandAliases()

Symfony Console dislikes certain command aliases, because they are too similar to other Drush commands that contain the same characters. To avoid the "I don't know which command you mean"-type errors, we will replace problematic aliases with their longhand equivalents.

preflightArgs($argv)

Preprocess the args, removing any @sitealias that may be present.

void
prepareConfig(Environment $environment)

Create the initial config locator object, and inject any needed settings, paths and so on into it.

InputInterface
createInput()

No description

array
getCommandFilePaths()

No description

ClassLoader
config()

No description

array
preflight($argv)

No description

preferredSite()

Find the Drupal root of the preferred Drupal site (the one that shares the vendor directory with Drush).

drupalFinder()

Return the Drupal Finder

SiteAliasManager
aliasManager()

Return the alias manager

environment()

Return the environment

Details

__construct(Environment $environment, $verify = null, $configLocator = null, $preflightLog = null)

Preflight constructor

Parameters

Environment $environment
$verify
$configLocator
$preflightLog

PreflightLog logger()

No description

Return Value

PreflightLog

void setLogger(PreflightLog $logger)

No description

Parameters

PreflightLog $logger

Return Value

void

void init()

Perform preliminary initialization. This mostly involves setting up legacy systems.

Return Value

void

protected array remapOptions()

Remapping table for arguments. Anything found in a key here will be converted to the corresponding value entry.

For example: --ssh-options='-i mysite_dsa' will become: -Dssh.options='-i mysite_dsa'

TODO: We could consider loading this from a file or some other source. However, this table is needed very early -- even earlier than config is loaded (since this is needed for preflighting the arguments, which can select config files to load). Hardcoding is probably best; we might want to move to another class, perhaps. We also need this prior to Dependency Injection, though.

Eventually, we might want to expose this table to some form of 'help' output, so folks can see the available conversions.

Return Value

array

protected array remapCommandAliases()

Symfony Console dislikes certain command aliases, because they are too similar to other Drush commands that contain the same characters. To avoid the "I don't know which command you mean"-type errors, we will replace problematic aliases with their longhand equivalents.

This should be fixed in Symfony Console.

Return Value

array

PreflightArgs preflightArgs($argv)

Preprocess the args, removing any @sitealias that may be present.

Arguments and options not used during preflight will be processed with an ArgvInput.

Parameters

$argv

Return Value

PreflightArgs

void prepareConfig(Environment $environment)

Create the initial config locator object, and inject any needed settings, paths and so on into it.

Parameters

Environment $environment

Return Value

void

InputInterface createInput()

No description

Return Value

InputInterface

array getCommandFilePaths()

No description

Return Value

array

ClassLoader loadSymfonyCompatabilityAutoloader()

No description

Return Value

ClassLoader

DrushConfig config()

No description

Return Value

DrushConfig

array preflight($argv)

No description

Parameters

$argv

True if the request was successfully redispatched remotely. False if the request should proceed.

Return Value

array

protected preferredSite()

Find the Drupal root of the preferred Drupal site (the one that shares the vendor directory with Drush).

DrushDrupalFinder drupalFinder()

Return the Drupal Finder

Return Value

DrushDrupalFinder

SiteAliasManager aliasManager()

Return the alias manager

Return Value

SiteAliasManager

Environment environment()

Return the environment

Return Value

Environment