allow non-interactive installation (#932)
This commit is contained in:
@@ -76,16 +76,9 @@ class InstallCommand extends Command
|
|||||||
{
|
{
|
||||||
$io = new SymfonyStyle($input, $output);
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
$io->title('Welcome to the interactive Kimai installer!');
|
$io->title('Kimai installer - v' . Constants::VERSION);
|
||||||
|
|
||||||
if (!$input->isInteractive()) {
|
$result = $this->reviewPermissions($io, $input, $output);
|
||||||
$io->error('Installation only works in interactive mode');
|
|
||||||
|
|
||||||
return self::ERROR_INTERACTIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$rows = $this->checkPermissions();
|
|
||||||
$result = $this->confirmAbortToReviewPermissions($io, $input, $output, $rows);
|
|
||||||
if (true !== $result) {
|
if (true !== $result) {
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
@@ -95,7 +88,6 @@ class InstallCommand extends Command
|
|||||||
// $io->note(sprintf('You have chosen the "%s" environment', $environment));
|
// $io->note(sprintf('You have chosen the "%s" environment', $environment));
|
||||||
$environment = getenv('APP_ENV');
|
$environment = getenv('APP_ENV');
|
||||||
|
|
||||||
// create database if necessary
|
|
||||||
try {
|
try {
|
||||||
$this->createDatabase($io, $input, $output);
|
$this->createDatabase($io, $input, $output);
|
||||||
} catch (\Exception $ex) {
|
} catch (\Exception $ex) {
|
||||||
@@ -132,9 +124,12 @@ class InstallCommand extends Command
|
|||||||
|
|
||||||
protected function rebuildCaches(string $environment, SymfonyStyle $io, InputInterface $input, OutputInterface $output)
|
protected function rebuildCaches(string $environment, SymfonyStyle $io, InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
if (!$this->askConfirmation($input, $output, 'Do you want me to rebuild the caches (yes) or skip this step (no)?', true)) {
|
if ($input->isInteractive()) {
|
||||||
|
$question = 'Do you want me to rebuild the caches (yes) or skip this step (no)?';
|
||||||
|
if (!$this->askConfirmation($input, $output, $question, true)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$io->text('Rebuilding your cache now, please be patient ...');
|
$io->text('Rebuilding your cache now, please be patient ...');
|
||||||
|
|
||||||
@@ -196,8 +191,14 @@ class InstallCommand extends Command
|
|||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function confirmAbortToReviewPermissions(SymfonyStyle $io, InputInterface $input, OutputInterface $output, array $permissions)
|
protected function reviewPermissions(SymfonyStyle $io, InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
if (!$input->isInteractive()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$permissions = $this->checkPermissions();
|
||||||
|
|
||||||
if (empty($permissions)) {
|
if (empty($permissions)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -217,6 +218,8 @@ class InstallCommand extends Command
|
|||||||
return self::ERROR_PERMISSIONS;
|
return self::ERROR_PERMISSIONS;
|
||||||
}
|
}
|
||||||
$io->writeln('');
|
$io->writeln('');
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function importMigrations(SymfonyStyle $io, OutputInterface $output)
|
protected function importMigrations(SymfonyStyle $io, OutputInterface $output)
|
||||||
|
|||||||
Reference in New Issue
Block a user