Skip to content

Commit

Permalink
on installation save channel to config.php if not stable
Browse files Browse the repository at this point in the history
- the default channel to the NC server is what is provided in /version.php
  unless it is overridden in config.php
- the default channel to the NC Updater however is 'stable'
- this resultant in inconsistent results and confusing admin experience
- therefore "stable" is considered default and other channels are being
  written to config.php now upon installation

Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
  • Loading branch information
blizzz committed Sep 19, 2022
1 parent a733a77 commit 0fc5d7d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,12 @@ public function install($options) {
$config = \OC::$server->getConfig();
$config->setAppValue('core', 'installedat', microtime(true));
$config->setAppValue('core', 'lastupdatedat', microtime(true));
$config->setAppValue('core', 'vendor', $this->getVendor());

$vendorData = $this->getVendorData();
$config->setAppValue('core', 'vendor', $vendorData['vendor']);
if ($vendorData['channel'] !== 'stable') {
$config->setSystemValue('updater.release.channel', $vendorData['channel']);
}

$group = \OC::$server->getGroupManager()->createGroup('admin');
if ($group instanceof IGroup) {
Expand Down Expand Up @@ -591,17 +596,14 @@ public static function protectDataDirectory() {
file_put_contents($baseDir . '/index.html', '');
}

/**
* Return vendor from which this version was published
*
* @return string Get the vendor
*
* Copy of \OC\Updater::getVendor()
*/
private function getVendor() {
private function getVendorData() {
// this should really be a JSON file
require \OC::$SERVERROOT . '/version.php';
/** @var string $vendor */
return (string)$vendor;
/** @var mixed $vendor */
/** @var mixed $OC_Channel */
return [
'vendor' => (string)$vendor,
'channel' => (string)$OC_Channel,
];
}
}

0 comments on commit 0fc5d7d

Please sign in to comment.