class DrupalBoot8 extends DrupalBoot (View source)

Traits

LoggerAwareTrait

Properties

protected string|bool $uri from  BaseBoot
protected int $phase from  BaseBoot
protected LoggrInterface|null $drupalLoggerAdapter
protected DrupalKernelInterface|null $kernel
protected Request $request

Methods

__construct(ServiceManager $serviceManager, $autoloader)

No description

findUri($root, $cwd)

Select the best URI for the provided cwd. Only called if the user did not explicitly specify a URI.

string
getUri()

No description

from  BaseBoot
setUri(string $uri)

Inject the uri for the specific site to be bootstrapped

from  BaseBoot
int
getPhase()

No description

from  BaseBoot
void
setPhase(int $phase)

No description

from  BaseBoot
bool
validRoot(string|null $path)

This function determines if the specified path points to the root directory of a CMS that can be bootstrapped by the specific subclass that implements it.

string|null
getVersion($drupal_root)

Given a site root directory, determine the exact version of the software.

commandDefaults()

No description

from  BaseBoot
reportCommandError($command)

Called by Drush if a command is not found, or if the command was found, but did not meet requirements.

from  BaseBoot
array
bootstrapPhaseMap()

Return an array mapping from bootstrap phase shorthand strings (e.g. "full") to the corresponding bootstrap phase index constant (e.g. DRUSH_BOOTSTRAP_DRUPAL_FULL).

lookUpPhaseIndex($phase)

Convert from a phase shorthand or constant to a phase index.

from  BaseBoot
bootstrapDrush()

No description

from  BaseBoot
bool
hasRegisteredSymfonyCommand($application, $name)

No description

from  BaseBoot
void
terminate()

This method is called during the shutdown of drush.

scanUpForUri($root, $scan)

No description

string|null
confPath(bool $require_settings = true, bool $reset = false)

Beware, this function populates Database::Connection info.

array
bootstrapPhases()

Bootstrap phases used with Drupal:

bool
bootstrapDrupalRootValidate(BootstrapManager $manager)

Validate the DRUSH_BOOTSTRAP_DRUPAL_ROOT phase.

void
bootstrapDrupalRoot(BootstrapManager $manager)

Bootstrap Drush with a valid Drupal Directory.

string
bootstrapDrupalCore(BootstrapManager $manager, string $drupal_root)

No description

bootstrapDrupalSiteValidate(BootstrapManager $manager)

VALIDATE the DRUSH_BOOTSTRAP_DRUPAL_SITE phase.

bootstrapDrupalSite(BootstrapManager $manager)

Initialize a site on the Drupal root.

bootstrapDrupalConfiguration(BootstrapManager $manager, AnnotationData $annotationData = null)

Initialize and load the Drupal configuration files.

bootstrapDrupalDatabaseValidate(BootstrapManager $manager)

Validate the DRUSH_BOOTSTRAP_DRUPAL_DATABASE phase

void
bootstrapDrupalDatabase(BootstrapManager $manager)

Bootstrap the Drupal database.

void
bootstrapDrupalFull(BootstrapManager $manager)

Attempt to load the full Drupal system.

Request
getRequest()

No description

void
setRequest(Request $request)

No description

DrupalKernelInterface
getKernel()

No description

void
setLogger(LoggerInterface $logger)

Sometimes (e.g. in the integration tests), the DrupalBoot object will be cached, and re-injected into a fresh set of preflight / bootstrap objects. When this happens, the new Drush logger will be injected into the boot object. If this happens after we have created the Drupal logger adapter (i.e., after bootstrapping Drupal), then we also need to update the logger reference in that adapter.

void
bootstrapDoDrupalSite(BootstrapManager $manager)

Called by bootstrapDrupalSite to do the main work of the Drush drupal site bootstrap.

void

Details

__construct(ServiceManager $serviceManager, $autoloader)

No description

Parameters

ServiceManager $serviceManager
$autoloader

findUri($root, $cwd)

Select the best URI for the provided cwd. Only called if the user did not explicitly specify a URI.

Parameters

$root
$cwd

string getUri()

No description

Return Value

string

setUri(string $uri)

Inject the uri for the specific site to be bootstrapped

Parameters

string $uri

Site to bootstrap

int getPhase()

No description

Return Value

int

void setPhase(int $phase)

No description

Parameters

int $phase

Return Value

void

bool validRoot(string|null $path)

This function determines if the specified path points to the root directory of a CMS that can be bootstrapped by the specific subclass that implements it.

These functions should be written such that one and only one class will return TRUE for any given $path.

Parameters

string|null $path

Return Value

bool

string|null getVersion($drupal_root)

Given a site root directory, determine the exact version of the software.

Parameters

$drupal_root

Return Value

string|null

The version string for the current version of the software, e.g. 8.1.3

commandDefaults()

No description

reportCommandError($command)

Called by Drush if a command is not found, or if the command was found, but did not meet requirements.

The implementation in BaseBoot should be sufficient for most cases, so this method typically will not need to be overridden.

Parameters

$command

array bootstrapPhaseMap()

Return an array mapping from bootstrap phase shorthand strings (e.g. "full") to the corresponding bootstrap phase index constant (e.g. DRUSH_BOOTSTRAP_DRUPAL_FULL).

Return Value

array

lookUpPhaseIndex($phase)

Convert from a phase shorthand or constant to a phase index.

Parameters

$phase

bootstrapDrush()

No description

protected bool hasRegisteredSymfonyCommand($application, $name)

No description

Parameters

$application
$name

Return Value

bool

void terminate()

This method is called during the shutdown of drush.

Return Value

void

protected scanUpForUri($root, $scan)

No description

Parameters

$root
$scan

string|null confPath(bool $require_settings = true, bool $reset = false)

Beware, this function populates Database::Connection info.

See https://github.com/drush-ops/drush/issues/3903.

Parameters

bool $require_settings
bool $reset

Return Value

string|null

array bootstrapPhases()

Bootstrap phases used with Drupal:

DRUSH_BOOTSTRAP_DRUSH = Only Drush. DRUSH_BOOTSTRAP_DRUPAL_ROOT = Find a valid Drupal root. DRUSH_BOOTSTRAP_DRUPAL_SITE = Find a valid Drupal site. DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION = Load the site's settings. DRUSH_BOOTSTRAP_DRUPAL_DATABASE = Initialize the database. DRUSH_BOOTSTRAP_DRUPAL_FULL = Initialize Drupal fully.

The value is the name of the method of the Boot class to execute when bootstrapping. Prior to bootstrapping, a "validate" method is called, if defined. The validate method name is the bootstrap method name with "_validate" appended.

Return Value

array

of PHASE index => method name.

bool bootstrapDrupalRootValidate(BootstrapManager $manager)

Validate the DRUSH_BOOTSTRAP_DRUPAL_ROOT phase.

In this function, we will check if a valid Drupal directory is available.

Parameters

BootstrapManager $manager

Return Value

bool

void bootstrapDrupalRoot(BootstrapManager $manager)

Bootstrap Drush with a valid Drupal Directory.

In this function, the pwd will be moved to the root of the Drupal installation.

We also now load the drush.yml for this specific Drupal site. We can now include files from the Drupal tree, and figure out more context about the codebase, such as the version of Drupal.

Parameters

BootstrapManager $manager

Return Value

void

string bootstrapDrupalCore(BootstrapManager $manager, string $drupal_root)

No description

Parameters

BootstrapManager $manager
string $drupal_root

Return Value

string

bootstrapDrupalSiteValidate(BootstrapManager $manager)

VALIDATE the DRUSH_BOOTSTRAP_DRUPAL_SITE phase.

In this function we determine the URL used for the command, and check for a valid settings.php file.

Parameters

BootstrapManager $manager

bootstrapDrupalSite(BootstrapManager $manager)

Initialize a site on the Drupal root.

We now set various contexts that we determined and confirmed to be valid. Additionally we load an optional drush.yml file in the site directory.

Parameters

BootstrapManager $manager

bootstrapDrupalConfiguration(BootstrapManager $manager, AnnotationData $annotationData = null)

Initialize and load the Drupal configuration files.

Parameters

BootstrapManager $manager
AnnotationData $annotationData

bootstrapDrupalDatabaseValidate(BootstrapManager $manager)

Validate the DRUSH_BOOTSTRAP_DRUPAL_DATABASE phase

Attempt to make a working database connection using the database credentials that were loaded during the previous phase.

Parameters

BootstrapManager $manager

void bootstrapDrupalDatabase(BootstrapManager $manager)

Bootstrap the Drupal database.

Parameters

BootstrapManager $manager

Return Value

void

void bootstrapDrupalFull(BootstrapManager $manager)

Attempt to load the full Drupal system.

Parameters

BootstrapManager $manager

Return Value

void

Request getRequest()

No description

Return Value

Request

void setRequest(Request $request)

No description

Parameters

Request $request

Return Value

void

DrupalKernelInterface getKernel()

No description

Return Value

DrupalKernelInterface

void setLogger(LoggerInterface $logger)

Sometimes (e.g. in the integration tests), the DrupalBoot object will be cached, and re-injected into a fresh set of preflight / bootstrap objects. When this happens, the new Drush logger will be injected into the boot object. If this happens after we have created the Drupal logger adapter (i.e., after bootstrapping Drupal), then we also need to update the logger reference in that adapter.

Parameters

LoggerInterface $logger

Return Value

void

void bootstrapDoDrupalSite(BootstrapManager $manager)

Called by bootstrapDrupalSite to do the main work of the Drush drupal site bootstrap.

Parameters

BootstrapManager $manager

Return Value

void

bool bootstrapDrupalConfigurationValidate(BootstrapManager $manager)

No description

Parameters

BootstrapManager $manager

Return Value

bool

void addDrupalModuleDrushCommands(BootstrapManager $manager)

No description

Parameters

BootstrapManager $manager

Return Value

void