Skip to content

Commit fb52a99

Browse files
sabbelasichonsimonschaufi
authored andcommitted
[TASK] Allow version 3 of consolidation/self-update (#804)
1 parent 9f2f027 commit fb52a99

File tree

7 files changed

+36
-2
lines changed

7 files changed

+36
-2
lines changed

bin/surf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
use SelfUpdate\SelfUpdateCommand;
12+
use SelfUpdate\SelfUpdateManager;
1213
use Symfony\Component\Config\FileLocator;
1314
use Symfony\Component\DependencyInjection\Container;
1415
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -29,7 +30,15 @@ foreach ($commandNamesToHide as $commandNameToHide) {
2930
$commandToHide = $application->get($commandNameToHide);
3031
$commandToHide->setHidden(true);
3132
}
32-
$application->add(new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf'));
33+
34+
if (class_exists(SelfUpdateManager::class)) {
35+
$selfUpdateManager = new SelfUpdateManager('TYPO3 Surf', $application->getVersion(), 'typo3/surf');
36+
$selfUpdateCommand = new SelfUpdateCommand($selfUpdateManager);
37+
} else {
38+
$selfUpdateCommand = new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf');
39+
}
40+
$application->add($selfUpdateCommand);
41+
3342
$application->run();
3443

3544
function requireAutoloader()

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
"require": {
1111
"php": "^7.4 || ^8.0",
12-
"consolidation/self-update": "^2.1",
12+
"consolidation/self-update": "^2.1 || ^3.0",
1313
"guzzlehttp/guzzle": "^6.0 || ^7.0",
1414
"monolog/monolog": "^2.9.1",
1515
"myclabs/php-enum": "^1.8",

src/Command/DeployCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class DeployCommand extends Command
2727
*/
2828
protected static $defaultName = 'deploy';
2929

30+
public static function getDefaultName(): ?string
31+
{
32+
return 'deploy';
33+
}
34+
3035
public function __construct(FactoryInterface $factory)
3136
{
3237
parent::__construct();

src/Command/DescribeCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ class DescribeCommand extends Command
3535
*/
3636
protected static $defaultName = 'describe';
3737

38+
public static function getDefaultName(): ?string
39+
{
40+
return 'describe';
41+
}
42+
3843
public function __construct(FactoryInterface $factory)
3944
{
4045
parent::__construct();

src/Command/RollbackCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory)
3333
$this->factory = $factory;
3434
}
3535

36+
public static function getDefaultName(): ?string
37+
{
38+
return 'rollback';
39+
}
40+
3641
protected function configure(): void
3742
{
3843
$this->setDescription('Rollback current to previous release and remove current folder')

src/Command/ShowCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ public function __construct(FactoryInterface $factory)
3232
$this->factory = $factory;
3333
}
3434

35+
public static function getDefaultName(): ?string
36+
{
37+
return 'show';
38+
}
39+
3540
protected function configure(): void
3641
{
3742
$this->setDescription('Shows all the deployments depending on the directory configuration')

src/Command/SimulateCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory)
3333
$this->factory = $factory;
3434
}
3535

36+
public static function getDefaultName(): ?string
37+
{
38+
return 'simulate';
39+
}
40+
3641
protected function configure(): void
3742
{
3843
$this->setDescription('Simulates the deployment for the given name')

0 commit comments

Comments
 (0)