function InstallCommand::execute
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::execute()
- 10 core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::execute()
- 11.x core/lib/Drupal/Core/Command/InstallCommand.php \Drupal\Core\Command\InstallCommand::execute()
File
-
core/
lib/ Drupal/ Core/ Command/ InstallCommand.php, line 63
Class
- InstallCommand
- Installs a Drupal site for local testing/development.
Namespace
Drupal\Core\CommandCode
protected function execute(InputInterface $input, OutputInterface $output) {
$io = new SymfonyStyle($input, $output);
if (!extension_loaded('pdo_sqlite')) {
$io->getErrorStyle()
->error('You must have the pdo_sqlite PHP extension installed. See core/INSTALL.sqlite.txt for instructions.');
return 1;
}
// Change the directory to the Drupal root.
chdir(dirname(__DIR__, 5));
// Check whether there is already an installation.
if ($this->isDrupalInstalled()) {
// Do not fail if the site is already installed so this command can be
// chained with ServerCommand.
$output->writeln('<info>Drupal is already installed.</info> If you want to reinstall, remove sites/default/files and sites/default/settings.php.');
return 0;
}
$install_profile = $input->getArgument('install-profile');
if ($install_profile && !$this->validateProfile($install_profile, $io)) {
return 1;
}
if (!$install_profile) {
$install_profile = $this->selectProfile($io);
}
return $this->install($this->classLoader, $io, $install_profile, $input->getOption('langcode'), $this->getSitePath(), $input->getOption('site-name'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.