diff --git a/.gitignore b/.gitignore index f7ead8cb..c7c60320 100644 --- a/.gitignore +++ b/.gitignore @@ -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 e1ad2de4..563cfa06 100644 --- a/lib/CommandApplication.php +++ b/lib/CommandApplication.php @@ -32,6 +32,10 @@ * @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 1d54a9b2..c3b0c381 100644 --- a/lib/UpdateCommand.php +++ b/lib/UpdateCommand.php @@ -63,15 +63,19 @@ protected function configure() { ->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 index c0a19910..a7d97813 100755 Binary files a/updater.phar and b/updater.phar differ