Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/updater.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-09-01 14:59:59 +0300
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-09-01 14:59:59 +0300
commitcee9258cf3c369ad5f514775acefd534a16cb25c (patch)
tree4a8484c6e49d545aefcc7477f87fbc166d1c17a4
parentb190d122ef7786f3af20042ced35f18b311cc1d3 (diff)
Fix --version option for updaterfix/add-workflow-updater-phar
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--lib/CommandApplication.php4
-rw-r--r--lib/UpdateCommand.php14
2 files changed, 13 insertions, 5 deletions
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('');