class InstallCommand extends Command (View source)

Constants

RETURN_CODE_ON_FAILURE

The return code we should return when an exception is thrown while running the command.

ALLOWASROOT_OPTION

The name of the CLI option that allows running CLI commands as root without confirmation.

ALLOWASROOT_ENV

The name of the environment variable that allows running CLI commands as root without confirmation.

private OPTIONPRECONDITIONS_ERROR

private OPTIONPRECONDITIONS_WARNINGS

private OPTIONPRECONDITIONS_SUCCESS

Properties

protected bool $canRunAsRoot

Can this command be executed as root? If set to false, the command can be executed if one of these conditions is satisfied:

  • the users is not root
  • the --allow-as-root option is set
  • the C5_CLI_ALLOW_AS_ROOT environment variable is set
  • the console is interactive and the user explicitly confirm the operation.
from  Command
private bool|null $preconditionsPassed
private Installer|null $configuredInstaller

Methods

run(InputInterface $input, OutputInterface $output)

{@inheritdoc}

from  Command
initialize(InputInterface $input, OutputInterface $output)

{@inheritdoc}

from  Command
writeError(OutputInterface $output, Exception|Throwable $error)

Write an exception.

from  Command
$this
addEnvOption()

Add the "env" option to the command options.

from  Command
$this
setCanRunAsRoot(bool $canRunAsRoot)

Allow/disallow running this command as root without confirmation.

from  Command
bool|null
isRunningAsRoot()

Is the current user root?

from  Command
confirmRunningAsRoot(InputInterface $input, OutputInterface $output)

No description

from  Command
configure()

No description

execute(InputInterface $input, OutputInterface $output)

No description

interact(InputInterface $input, OutputInterface $output)

No description

Question
getQuestion($row, InputInterface $input)

Do some procedural work to a row in the wizard step list to turn it into a proper question.

Generator|Question[]
getWizard(InputInterface $input, OutputInterface $output, null $firstKey = null)

A wizard generator.

string
getQuestionString(InputOption $option, $default)

Take an option and return a question string.

array
wizardSteps()

An array of steps Items: [ "option-name", "default-value", function($question, $input, $option) : $question ].

getPreconditionsPassed(Application $app, OutputInterface $output)

No description

bool
checkPreconditions(Application $app, OutputInterface $output)

No description

array
getFinalOptions(InputInterface $input)

No description

buildInstaller(array $options)

No description

int
checkOptionPreconditions(Application $app, Installer $installer, InputInterface $input, OutputInterface $output)

No description

Details

run(InputInterface $input, OutputInterface $output)

{@inheritdoc}

Parameters

InputInterface $input
OutputInterface $output

protected initialize(InputInterface $input, OutputInterface $output)

{@inheritdoc}

Parameters

InputInterface $input
OutputInterface $output

See also

\Symfony\Component\Console\Command\Command::initialize()

protected writeError(OutputInterface $output, Exception|Throwable $error)

Write an exception.

Parameters

OutputInterface $output
Exception|Throwable $error

protected $this addEnvOption()

Add the "env" option to the command options.

Return Value

$this

protected $this setCanRunAsRoot(bool $canRunAsRoot)

Allow/disallow running this command as root without confirmation.

Parameters

bool $canRunAsRoot

if false the command can be executed if one of these conditions is satisfied:

  • the users is not root
  • the --allow-as-root option is set
  • the C5_CLI_ALLOW_AS_ROOT environment variable is set
  • the console is interactive and the user explicitly confirm the operation

Return Value

$this

protected bool|null isRunningAsRoot()

Is the current user root?

Return Value

bool|null

NULL if unknown, or boolean if determined

protected confirmRunningAsRoot(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

Exceptions

UserMessageException

protected configure()

No description

protected execute(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

protected interact(InputInterface $input, OutputInterface $output)

No description

Parameters

InputInterface $input
OutputInterface $output

private Question getQuestion($row, InputInterface $input)

Do some procedural work to a row in the wizard step list to turn it into a proper question.

Parameters

$row
InputInterface $input

Return Value

Question

private Generator|Question[] getWizard(InputInterface $input, OutputInterface $output, null $firstKey = null)

A wizard generator.

Parameters

InputInterface $input
OutputInterface $output
null $firstKey

Return Value

Generator|Question[]

private string getQuestionString(InputOption $option, $default)

Take an option and return a question string.

Parameters

InputOption $option
$default

Return Value

string

private array wizardSteps()

An array of steps Items: [ "option-name", "default-value", function($question, $input, $option) : $question ].

Return Value

array

private getPreconditionsPassed(Application $app, OutputInterface $output)

No description

Parameters

Application $app
OutputInterface $output

private bool checkPreconditions(Application $app, OutputInterface $output)

No description

Parameters

Application $app
OutputInterface $output

Return Value

bool

private array getFinalOptions(InputInterface $input)

No description

Parameters

InputInterface $input

Return Value

array

private Installer buildInstaller(array $options)

No description

Parameters

array $options

Return Value

Installer

private int checkOptionPreconditions(Application $app, Installer $installer, InputInterface $input, OutputInterface $output)

No description

Parameters

Application $app
Installer $installer
InputInterface $input
OutputInterface $output

Return Value

int

One of the InstallCommand::OPTIONPRECONDITIONS_... constants