diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2022-09-02 23:37:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 23:37:00 +0300 |
commit | 344fa3f9827d791ebc2c0a0d8bb19dd18da3b67a (patch) | |
tree | 84d63a56478e06fbbb33dc6afe45a52af829655a | |
parent | 121af7e14845a10093ba9e9fafea63cd01a67daf (diff) | |
parent | f3e2bcd82eb1c0c1990c68baebd84dfa24e6d924 (diff) |
Merge pull request #433 from nextcloud/fix/fix-version-optionHEADv25.0.1rc1v25.0.1v25.0.0rc5v25.0.0rc4v25.0.0rc3v25.0.0rc2v25.0.0rc1v25.0.0beta7v25.0.0beta6v25.0.0beta5v25.0.0stable25master
Fix --version option
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | lib/CommandApplication.php | 4 | ||||
-rw-r--r-- | lib/UpdateCommand.php | 14 | ||||
-rwxr-xr-x | updater.phar | bin | 788795 -> 788986 bytes |
4 files changed, 15 insertions, 6 deletions
@@ -4,4 +4,5 @@ tests/data tests/vendor vendor/symfony/console/Tests vendor/symfony/debug/Tests -/vendor-bin/**/vendor
\ No newline at end of file +/vendor-bin/**/vendor +.php-cs-fixer.cache diff --git a/lib/CommandApplication.php b/lib/CommandApplication.php index e1ad2de..563cfa0 100644 --- a/lib/CommandApplication.php +++ b/lib/CommandApplication.php @@ -32,6 +32,10 @@ use Symfony\Component\Console\Input\InputInterface; * @package NC\Updater */ class CommandApplication extends Application { + public function __construct(string $name = 'update') { + parent::__construct($name, UpdateCommand::getUpdaterVersion()); + } + /** * Gets the name of the command based on input. * diff --git a/lib/UpdateCommand.php b/lib/UpdateCommand.php index 1d54a9b..c3b0c38 100644 --- a/lib/UpdateCommand.php +++ b/lib/UpdateCommand.php @@ -63,15 +63,19 @@ class UpdateCommand extends Command { ->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version'); } - protected function execute(InputInterface $input, OutputInterface $output) { - $this->skipBackup = $input->getOption('no-backup'); - + public static function getUpdaterVersion(): string { if (class_exists('NC\Updater\Version')) { $versionClass = new Version(); - $version = $versionClass->get(); + return $versionClass->get(); } else { - $version = 'directly run from git checkout'; + return 'git'; } + } + + protected function execute(InputInterface $input, OutputInterface $output) { + $this->skipBackup = $input->getOption('no-backup'); + + $version = static::getUpdaterVersion(); $output->writeln('Nextcloud Updater - version: ' . $version); $output->writeln(''); diff --git a/updater.phar b/updater.phar Binary files differindex c0a1991..a7d9781 100755 --- a/updater.phar +++ b/updater.phar |