Skip to content

Commit

Permalink
Merge pull request #34136 from nextcloud/fix/default-channel
Browse files Browse the repository at this point in the history
on installation save channel to config.php if not stable
  • Loading branch information
blizzz authored Oct 21, 2022
2 parents 4aa8e80 + 2ef9826 commit 294a00d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
3 changes: 3 additions & 0 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3371,6 +3371,9 @@
<code>$content !== ''</code>
<code>$type === 'pdo'</code>
</RedundantCondition>
<UndefinedVariable occurrences="1">
<code>$vendor</code>
</UndefinedVariable>
</file>
<file src="lib/private/Setup/AbstractDatabase.php">
<UndefinedThisPropertyFetch occurrences="4">
Expand Down
24 changes: 13 additions & 11 deletions lib/private/Setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,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 @@ -582,17 +587,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(): array {
// 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 294a00d

Please sign in to comment.