Skip to content
Merged
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: 5 additions & 0 deletions config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,11 @@
*/
'updater.server.url' => 'https://updates.nextcloud.org/server/',

/**
* Release channel to use for updates
*/
'updater.release.channel' => 'stable',

/**
* Is Nextcloud connected to the Internet or running in a closed network?
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/private/repair.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use OC\Repair\CopyRewriteBaseToConfig;
use OC\Repair\DropOldJobs;
use OC\Repair\EncryptionCompatibility;
use OC\Repair\MoveChannelToSystemConfig;
use OC\Repair\OldGroupMembershipShares;
use OC\Repair\RemoveGetETagEntries;
use OC\Repair\SqliteAutoincrement;
Expand Down Expand Up @@ -118,6 +119,7 @@ public static function getRepairSteps() {
new UpdateOutdatedOcsIds(\OC::$server->getConfig()),
new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
new AvatarPermissions(\OC::$server->getDatabaseConnection()),
new MoveChannelToSystemConfig(\OC::$server->getConfig()),
];
}

Expand Down
51 changes: 51 additions & 0 deletions lib/private/repair/movechanneltosystemconfig.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OC\Repair;

use OC\Hooks\BasicEmitter;
use OCP\IConfig;

/**
* Class MoveChannelToSystemConfig moves the defined OC_Channel in the app config
* to the system config to be compatible with the Nextcloud updater.
*
* @package OC\Repair
*/
class MoveChannelToSystemConfig extends BasicEmitter implements \OC\RepairStep {
/** @var IConfig */
private $config;

public function __construct(IConfig $config) {
$this->config = $config;
}

public function getName() {
return 'Moves the stored release channel to the config file';
}

public function run() {
$channel = $this->config->getAppValue('core', 'OC_Channel', '');
if($channel !== '') {
$this->config->setSystemValue('updater.release.channel', $channel);
$this->config->deleteAppValue('core', 'OC_Channel');
}
}
}
5 changes: 3 additions & 2 deletions lib/private/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ public static function getEditionString() {
}

/**
* @description get the update channel of the current installed of ownCloud.
* Get the currently configured release channel
*
* @return string
*/
public static function getChannel() {
Expand Down Expand Up @@ -421,7 +422,7 @@ private static function loadVersion() {
// Allow overriding update channel

if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
$channel = \OC::$server->getAppConfig()->getValue('core', 'OC_Channel');
$channel = \OC::$server->getConfig()->getSystemValue('updater.release.channel', null);
} else {
/** @var $OC_Channel string */
$channel = $OC_Channel;
Expand Down
2 changes: 1 addition & 1 deletion lib/public/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public static function getVersion() {
*/
public static function setChannel($channel) {
//Flush timestamp to reload version.php
\OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel);
\OC::$server->getSession()->set('OC_Version_Timestamp', 0);
\OC::$server->getAppConfig()->setValue('core', 'OC_Channel', $channel);
}

/**
Expand Down