Skip to content

Commit 294a00d

Browse files
authored
Merge pull request #34136 from nextcloud/fix/default-channel
on installation save channel to config.php if not stable
2 parents 4aa8e80 + 2ef9826 commit 294a00d

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

build/psalm-baseline.xml

+3
Original file line numberDiff line numberDiff line change
@@ -3371,6 +3371,9 @@
33713371
<code>$content !== ''</code>
33723372
<code>$type === 'pdo'</code>
33733373
</RedundantCondition>
3374+
<UndefinedVariable occurrences="1">
3375+
<code>$vendor</code>
3376+
</UndefinedVariable>
33743377
</file>
33753378
<file src="lib/private/Setup/AbstractDatabase.php">
33763379
<UndefinedThisPropertyFetch occurrences="4">

lib/private/Setup.php

+13-11
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,12 @@ public function install($options) {
393393
$config = \OC::$server->getConfig();
394394
$config->setAppValue('core', 'installedat', microtime(true));
395395
$config->setAppValue('core', 'lastupdatedat', microtime(true));
396-
$config->setAppValue('core', 'vendor', $this->getVendor());
396+
397+
$vendorData = $this->getVendorData();
398+
$config->setAppValue('core', 'vendor', $vendorData['vendor']);
399+
if ($vendorData['channel'] !== 'stable') {
400+
$config->setSystemValue('updater.release.channel', $vendorData['channel']);
401+
}
397402

398403
$group = \OC::$server->getGroupManager()->createGroup('admin');
399404
if ($group instanceof IGroup) {
@@ -582,17 +587,14 @@ public static function protectDataDirectory() {
582587
file_put_contents($baseDir . '/index.html', '');
583588
}
584589

585-
/**
586-
* Return vendor from which this version was published
587-
*
588-
* @return string Get the vendor
589-
*
590-
* Copy of \OC\Updater::getVendor()
591-
*/
592-
private function getVendor() {
590+
private function getVendorData(): array {
593591
// this should really be a JSON file
594592
require \OC::$SERVERROOT . '/version.php';
595-
/** @var string $vendor */
596-
return (string)$vendor;
593+
/** @var mixed $vendor */
594+
/** @var mixed $OC_Channel */
595+
return [
596+
'vendor' => (string)$vendor,
597+
'channel' => (string)$OC_Channel,
598+
];
597599
}
598600
}

0 commit comments

Comments
 (0)