Skip to content

Commit 72af140

Browse files
committed
Move CAN_INSTALL check to method and remove unlink from SetupController
Move the check for the CAN_INSTALL file in the config directory to a method in the Setup class and remove the call to unlink from the SetupController as this in now handled in the Setup class. Signed-off-by: Alex Harpin <development@landsofshadow.co.uk>
1 parent 467c8a9 commit 72af140

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

core/Controller/SetupController.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function run(array $post): void {
5959
$post['dbpass'] = $post['dbpassword'];
6060
}
6161

62-
if (!is_file(\OC::$configDir.'/CAN_INSTALL')) {
62+
if (!$this->setupHelper->canInstallExists()) {
6363
$this->displaySetupForbidden();
6464
return;
6565
}
@@ -107,10 +107,8 @@ private function finishSetup() {
107107
}
108108
\OC::$server->getIntegrityCodeChecker()->runInstanceVerification();
109109

110-
if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) {
111-
if (!unlink(\OC::$configDir.'/CAN_INSTALL')) {
112-
\OC_Template::printGuestPage('', 'installation_incomplete');
113-
}
110+
if ($this->setupHelper->canInstallExists()) {
111+
\OC_Template::printGuestPage('', 'installation_incomplete');
114112
}
115113

116114
header('Location: ' . \OC::$server->getURLGenerator()->getAbsoluteURL('index.php/core/apps/recommended'));

lib/private/Setup.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ public function install($options) {
419419

420420
//and we are done
421421
$config->setSystemValue('installed', true);
422-
if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) {
422+
if (self::canInstallExists()) {
423423
unlink(\OC::$configDir.'/CAN_INSTALL');
424424
}
425425

@@ -599,4 +599,11 @@ private function getVendorData(): array {
599599
'channel' => (string)$OC_Channel,
600600
];
601601
}
602+
603+
/**
604+
* @return bool
605+
*/
606+
public function canInstallExists() {
607+
return \OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL');
608+
}
602609
}

0 commit comments

Comments
 (0)