From: Alex Harpin Date: Sat, 19 Jun 2021 20:06:57 +0000 (+0100) Subject: Rename canInstallExists method and add new method for removal X-Git-Tag: v26.0.0beta1~50^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=644df591b138d28b1631ecc13ebe600c16a909f1;p=nextcloud-server.git Rename canInstallExists method and add new method for removal Rename canInstallExists to shouldRemoveCanInstallFile to cover removal of this file for non-git channels and logging any failure to remove it. Add new method to detect if this file exists during web based installation. Signed-off-by: Alex Harpin --- diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php index c06cffe7dfc..d53cd867b06 100644 --- a/core/Command/Maintenance/Install.php +++ b/core/Command/Maintenance/Install.php @@ -107,7 +107,7 @@ class Install extends Command { $this->printErrors($output, $errors); return 1; } - if ($setupHelper->canInstallExists()) { + if ($setupHelper->shouldRemoveCanInstallFile()) { $output->writeln('Could not remove CAN_INSTALL from the config folder. Please remove this file manually.'); } $output->writeln("Nextcloud was successfully installed"); diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index b4f41b48da2..cdab39edf84 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -59,7 +59,7 @@ class SetupController { $post['dbpass'] = $post['dbpassword']; } - if (!$this->setupHelper->canInstallExists()) { + if (!$this->setupHelper->canInstallFileExists()) { $this->displaySetupForbidden(); return; } @@ -107,7 +107,7 @@ class SetupController { } \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); - if ($this->setupHelper->canInstallExists()) { + if ($this->setupHelper->shouldRemoveCanInstallFile()) { \OC_Template::printGuestPage('', 'installation_incomplete'); } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index bd176984678..e84a5e4987a 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -419,7 +419,7 @@ class Setup { //and we are done $config->setSystemValue('installed', true); - if (self::canInstallExists()) { + if (self::shouldRemoveCanInstallFile()) { unlink(\OC::$configDir.'/CAN_INSTALL'); } @@ -603,7 +603,14 @@ class Setup { /** * @return bool */ - public function canInstallExists() { + public function shouldRemoveCanInstallFile() { return \OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL'); } + + /** + * @return bool + */ + public function canInstallFileExists() { + return is_file(\OC::$configDir.'/CAN_INSTALL'); + } }