Skip to content

Commit ca4f893

Browse files
committed
Remobe AbstractInstallationCommand
1 parent 241d61d commit ca4f893

File tree

3 files changed

+34
-40
lines changed

3 files changed

+34
-40
lines changed

src/Command/AbstractInstallCommand.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/Command/InstallCommand.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,33 @@
44

55
namespace Shlinkio\Shlink\Installer\Command;
66

7-
class InstallCommand extends AbstractInstallCommand
7+
use Shlinkio\Shlink\Installer\Service\InstallationRunnerInterface;
8+
use Symfony\Component\Console\Command\Command;
9+
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Output\OutputInterface;
11+
use Symfony\Component\Console\Style\SymfonyStyle;
12+
13+
class InstallCommand extends Command
814
{
915
public const string NAME = 'install';
1016

17+
public function __construct(private readonly InstallationRunnerInterface $installationRunner)
18+
{
19+
parent::__construct();
20+
}
21+
1122
protected function configure(): void
1223
{
1324
$this
1425
->setName(self::NAME)
1526
->setDescription('Guides you through the installation process, to get Shlink up and running.');
1627
}
1728

18-
protected function isUpdate(): bool
29+
protected function execute(InputInterface $input, OutputInterface $output): int
1930
{
20-
return false;
31+
$io = new SymfonyStyle($input, $output);
32+
$initCommand = $this->getApplication()?->find(InitCommand::NAME);
33+
34+
return $this->installationRunner->runInstallation($initCommand, $io);
2135
}
2236
}

src/Command/UpdateCommand.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,33 @@
44

55
namespace Shlinkio\Shlink\Installer\Command;
66

7-
class UpdateCommand extends AbstractInstallCommand
7+
use Shlinkio\Shlink\Installer\Service\InstallationRunnerInterface;
8+
use Symfony\Component\Console\Command\Command;
9+
use Symfony\Component\Console\Input\InputInterface;
10+
use Symfony\Component\Console\Output\OutputInterface;
11+
use Symfony\Component\Console\Style\SymfonyStyle;
12+
13+
class UpdateCommand extends Command
814
{
915
public const string NAME = 'update';
1016

17+
public function __construct(private readonly InstallationRunnerInterface $installationRunner)
18+
{
19+
parent::__construct();
20+
}
21+
1122
protected function configure(): void
1223
{
1324
$this
1425
->setName(self::NAME)
1526
->setDescription('Helps you import Shlink\'s config from an older version to a new one.');
1627
}
1728

18-
protected function isUpdate(): bool
29+
protected function execute(InputInterface $input, OutputInterface $output): int
1930
{
20-
return true;
31+
$io = new SymfonyStyle($input, $output);
32+
$initCommand = $this->getApplication()?->find(InitCommand::NAME);
33+
34+
return $this->installationRunner->runUpdate($initCommand, $io);
2135
}
2236
}

0 commit comments

Comments
 (0)