diff --git a/bin/surf b/bin/surf index 823a6a57..dde45ea8 100755 --- a/bin/surf +++ b/bin/surf @@ -9,6 +9,7 @@ */ use SelfUpdate\SelfUpdateCommand; +use SelfUpdate\SelfUpdateManager; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -29,7 +30,15 @@ foreach ($commandNamesToHide as $commandNameToHide) { $commandToHide = $application->get($commandNameToHide); $commandToHide->setHidden(true); } -$application->add(new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf')); + +if (class_exists(SelfUpdateManager::class)) { + $selfUpdateManager = new SelfUpdateManager('TYPO3 Surf', $application->getVersion(), 'typo3/surf'); + $selfUpdateCommand = new SelfUpdateCommand($selfUpdateManager); +} else { + $selfUpdateCommand = new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf'); +} +$application->add($selfUpdateCommand); + $application->run(); function requireAutoloader() diff --git a/composer.json b/composer.json index c6629bd9..b5c99ea4 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ }, "require": { "php": "^7.4 || ^8.0", - "consolidation/self-update": "^2.1", + "consolidation/self-update": "^2.1 || ^3.0", "guzzlehttp/guzzle": "^6.0 || ^7.0", "monolog/monolog": "^2.9.1", "myclabs/php-enum": "^1.8", diff --git a/src/Command/DeployCommand.php b/src/Command/DeployCommand.php index 55ccba2f..fd845e85 100755 --- a/src/Command/DeployCommand.php +++ b/src/Command/DeployCommand.php @@ -27,6 +27,11 @@ class DeployCommand extends Command */ protected static $defaultName = 'deploy'; + public static function getDefaultName(): ?string + { + return 'deploy'; + } + public function __construct(FactoryInterface $factory) { parent::__construct(); diff --git a/src/Command/DescribeCommand.php b/src/Command/DescribeCommand.php index 4b401935..60e3e8fd 100755 --- a/src/Command/DescribeCommand.php +++ b/src/Command/DescribeCommand.php @@ -35,6 +35,11 @@ class DescribeCommand extends Command */ protected static $defaultName = 'describe'; + public static function getDefaultName(): ?string + { + return 'describe'; + } + public function __construct(FactoryInterface $factory) { parent::__construct(); diff --git a/src/Command/RollbackCommand.php b/src/Command/RollbackCommand.php index 6d9a3fca..4a969cd1 100644 --- a/src/Command/RollbackCommand.php +++ b/src/Command/RollbackCommand.php @@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory) $this->factory = $factory; } + public static function getDefaultName(): ?string + { + return 'rollback'; + } + protected function configure(): void { $this->setDescription('Rollback current to previous release and remove current folder') diff --git a/src/Command/ShowCommand.php b/src/Command/ShowCommand.php index 8962f7d3..a52854ed 100755 --- a/src/Command/ShowCommand.php +++ b/src/Command/ShowCommand.php @@ -32,6 +32,11 @@ public function __construct(FactoryInterface $factory) $this->factory = $factory; } + public static function getDefaultName(): ?string + { + return 'show'; + } + protected function configure(): void { $this->setDescription('Shows all the deployments depending on the directory configuration') diff --git a/src/Command/SimulateCommand.php b/src/Command/SimulateCommand.php index 23edf156..f0081b9e 100755 --- a/src/Command/SimulateCommand.php +++ b/src/Command/SimulateCommand.php @@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory) $this->factory = $factory; } + public static function getDefaultName(): ?string + { + return 'simulate'; + } + protected function configure(): void { $this->setDescription('Simulates the deployment for the given name')