diff --git a/config/CAN_INSTALL b/config/CAN_INSTALL new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/Controller/SetupController.php b/core/Controller/SetupController.php index 17d7b51d3f..00f32889ee 100644 --- a/core/Controller/SetupController.php +++ b/core/Controller/SetupController.php @@ -62,6 +62,11 @@ class SetupController { $post['dbpass'] = $post['dbpassword']; } + if (!is_file(\OC::$configDir.'/CAN_INSTALL')) { + $this->displaySetupForbidden(); + return; + } + if(isset($post['install']) AND $post['install']=='true') { // We have to launch the installation process : $e = $this->setupHelper->install($post); @@ -79,6 +84,10 @@ class SetupController { } } + private function displaySetupForbidden() { + \OC_Template::printGuestPage('', 'installation_forbidden'); + } + public function display($post) { $defaults = array( 'adminlogin' => '', @@ -103,6 +112,13 @@ class SetupController { unlink($this->autoConfigFile); } \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); + + if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) { + if (!unlink(\OC::$configDir.'/CAN_INSTALL')) { + \OC_Template::printGuestPage('', 'installation_incomplete'); + } + } + \OC_Util::redirectToDefaultPage(); } diff --git a/core/templates/installation_forbidden.php b/core/templates/installation_forbidden.php new file mode 100644 index 0000000000..743d14b133 --- /dev/null +++ b/core/templates/installation_forbidden.php @@ -0,0 +1,6 @@ +
+ t('It looks like you are trying to reinstall your Nextcloud. However the file CAN_INSTALL is missing from your config directory. Please create the file CAN_INSTALL in your config folder to continue.')) ?> +
++ t('Could not remove CAN_INSTALL from the config folder. Please remove this file manually.')) ?> +
+