class InstallCommand extends Command (View source)

internal  This command makes no guarantee of an API for Drupal extensions.
 

Installs a Drupal site for local testing/development.

Properties

protected object $classLoader

The class loader.

Methods

__construct(object $class_loader)

Constructs a new InstallCommand command.

configure()

{@inheritdoc}

execute(InputInterface $input, OutputInterface $output)

{@inheritdoc}

bool
isDrupalInstalled()

Returns whether there is already an existing Drupal installation.

int
install(object $class_loader, SymfonyStyle $io, string $profile, string $langcode, string $site_path, string $site_name)

Installs Drupal with specified installation profile.

string
getSitePath()

Gets the site path.

string
selectProfile(SymfonyStyle $io)

Selects the install profile to use.

bool
validateProfile(string $install_profile, SymfonyStyle $io)

Validates a user provided install profile.

string[]
getProfiles(bool $include_hidden = FALSE, bool $auto_select_distributions = TRUE)

Gets a list of profiles.

Details

__construct(object $class_loader)

Constructs a new InstallCommand command.

Parameters

object $class_loader

The class loader.

protected configure()

{@inheritdoc}

protected execute(InputInterface $input, OutputInterface $output)

{@inheritdoc}

Parameters

InputInterface $input
OutputInterface $output

protected bool isDrupalInstalled()

Returns whether there is already an existing Drupal installation.

Return Value

bool

protected int install(object $class_loader, SymfonyStyle $io, string $profile, string $langcode, string $site_path, string $site_name)

Installs Drupal with specified installation profile.

Parameters

object $class_loader

The class loader.

SymfonyStyle $io

The Symfony output decorator.

string $profile

The installation profile to use.

string $langcode

The language to install the site in.

string $site_path

The path to install the site to, like 'sites/default'.

string $site_name

The site name.

Return Value

int

The command exit status.

Exceptions

Exception

protected string getSitePath()

Gets the site path.

Defaults to 'sites/default'. For testing purposes this can be overridden using the DRUPAL_DEV_SITE_PATH environment variable.

Return Value

string

The site path to use.

protected string selectProfile(SymfonyStyle $io)

Selects the install profile to use.

Parameters

SymfonyStyle $io

Symfony style output decorator.

Return Value

string

The selected install profile.

See also

_install_select_profile()
SelectProfileForm

protected bool validateProfile(string $install_profile, SymfonyStyle $io)

Validates a user provided install profile.

Parameters

string $install_profile

Install profile to validate.

SymfonyStyle $io

Symfony style output decorator.

Return Value

bool

TRUE if the profile is valid, FALSE if not.

protected string[] getProfiles(bool $include_hidden = FALSE, bool $auto_select_distributions = TRUE)

Gets a list of profiles.

Parameters

bool $include_hidden

(optional) Whether to include hidden profiles. Defaults to FALSE.

bool $auto_select_distributions

(optional) Whether to only return the first distribution found.

Return Value

string[]

An array of profile descriptions keyed by the profile machine name.