Merge pull request #227 from nextcloud/stable9-channel-should-be-inside-config
[stable9] Move OC_Channel to system config
This commit is contained in:
commit
95f6dd909b
|
@ -500,6 +500,11 @@ $CONFIG = array(
|
|||
*/
|
||||
'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?
|
||||
*/
|
||||
|
|
|
@ -37,6 +37,7 @@ use OC\Repair\Collation;
|
|||
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;
|
||||
|
@ -118,6 +119,7 @@ class Repair extends BasicEmitter {
|
|||
new UpdateOutdatedOcsIds(\OC::$server->getConfig()),
|
||||
new RepairInvalidShares(\OC::$server->getConfig(), \OC::$server->getDatabaseConnection()),
|
||||
new AvatarPermissions(\OC::$server->getDatabaseConnection()),
|
||||
new MoveChannelToSystemConfig(\OC::$server->getConfig()),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
|
@ -384,7 +384,8 @@ class OC_Util {
|
|||
}
|
||||
|
||||
/**
|
||||
* @description get the update channel of the current installed of ownCloud.
|
||||
* Get the currently configured release channel
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getChannel() {
|
||||
|
@ -421,7 +422,7 @@ class OC_Util {
|
|||
// 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;
|
||||
|
|
|
@ -79,8 +79,8 @@ class Util {
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue