function QuickStartCommand::execute

Same name in other branches
  1. 9 core/lib/Drupal/Core/Command/QuickStartCommand.php \Drupal\Core\Command\QuickStartCommand::execute()
  2. 10 core/lib/Drupal/Core/Command/QuickStartCommand.php \Drupal\Core\Command\QuickStartCommand::execute()
  3. 11.x core/lib/Drupal/Core/Command/QuickStartCommand.php \Drupal\Core\Command\QuickStartCommand::execute()

File

core/lib/Drupal/Core/Command/QuickStartCommand.php, line 47

Class

QuickStartCommand
Installs a Drupal site and starts a webserver for local testing/development.

Namespace

Drupal\Core\Command

Code

protected function execute(InputInterface $input, OutputInterface $output) {
    $command = $this->getApplication()
        ->find('install');
    $arguments = [
        'command' => 'install',
        'install-profile' => $input->getArgument('install-profile'),
        '--langcode' => $input->getOption('langcode'),
        '--site-name' => $input->getOption('site-name'),
    ];
    $installInput = new ArrayInput($arguments);
    $returnCode = $command->run($installInput, $output);
    if ($returnCode === 0) {
        $command = $this->getApplication()
            ->find('server');
        $arguments = [
            'command' => 'server',
            '--host' => $input->getOption('host'),
            '--port' => $input->getOption('port'),
        ];
        if ($input->getOption('suppress-login')) {
            $arguments['--suppress-login'] = TRUE;
        }
        $serverInput = new ArrayInput($arguments);
        $returnCode = $command->run($serverInput, $output);
    }
    return $returnCode;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.