Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enc: add target version update (#336 ) #383

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/UpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,14 @@ protected function configure() {
->setName('update')
->setDescription('Updates the code of an Nextcloud instance')
->setHelp("This command fetches the latest code that is announced via the updater server and safely replaces the existing code with the new one.")
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version');
->addOption('no-backup', null, InputOption::VALUE_NONE, 'Skip backup of current Nextcloud version')
->addOption('target-version', null,InputOption::VALUE_REQUIRED, 'The target version that you want to update too', null);
}

protected function execute(InputInterface $input, OutputInterface $output) {
$this->skipBackup = $input->getOption('no-backup');
$this->targetVersion = $input->getOption('target-version');


if (class_exists('NC\Updater\Version')) {
$versionClass = new Version();
Expand Down
9 changes: 6 additions & 3 deletions lib/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,10 +516,13 @@ private function getUpdateServerResponse() {
*
* @throws \Exception
*/
public function downloadUpdate() {
public function downloadUpdate($targetVersion=null) {
$this->silentLog('[info] downloadUpdate()');

$response = $this->getUpdateServerResponse();
if ($targetVersion == null){
$response = $this->getUpdateServerResponse();
}else{
$response["url"]= 'https://download.nextcloud.com/server/releases/nextcloud-'.$targetVersion.'.zip';
}
$storageLocation = $this->getDataDirectoryLocation() . '/updater-'.$this->getConfigOption('instanceid') . '/downloads/';
if(file_exists($storageLocation)) {
$this->silentLog('[info] storage location exists');
Expand Down