Merge pull request #15112 from nextcloud/backport/14965/stable15
[stable15] Prevent a reinstall
This commit is contained in:
commit
d860057a01
|
@ -62,6 +62,11 @@ class SetupController {
|
||||||
$post['dbpass'] = $post['dbpassword'];
|
$post['dbpass'] = $post['dbpassword'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_file(\OC::$configDir.'/CAN_INSTALL')) {
|
||||||
|
$this->displaySetupForbidden();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if(isset($post['install']) AND $post['install']=='true') {
|
if(isset($post['install']) AND $post['install']=='true') {
|
||||||
// We have to launch the installation process :
|
// We have to launch the installation process :
|
||||||
$e = $this->setupHelper->install($post);
|
$e = $this->setupHelper->install($post);
|
||||||
|
@ -79,6 +84,10 @@ class SetupController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function displaySetupForbidden() {
|
||||||
|
\OC_Template::printGuestPage('', 'installation_forbidden');
|
||||||
|
}
|
||||||
|
|
||||||
public function display($post) {
|
public function display($post) {
|
||||||
$defaults = array(
|
$defaults = array(
|
||||||
'adminlogin' => '',
|
'adminlogin' => '',
|
||||||
|
@ -103,6 +112,13 @@ class SetupController {
|
||||||
unlink($this->autoConfigFile);
|
unlink($this->autoConfigFile);
|
||||||
}
|
}
|
||||||
\OC::$server->getIntegrityCodeChecker()->runInstanceVerification();
|
\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();
|
\OC_Util::redirectToDefaultPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="error">
|
||||||
|
<h2><?php p($l->t('Error')) ?></h2>
|
||||||
|
<p>
|
||||||
|
<?php p($l->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.')) ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<div class="error">
|
||||||
|
<h2><?php p($l->t('Error')) ?></h2>
|
||||||
|
<p>
|
||||||
|
<?php p($l->t('Could not remove CAN_INSTALL from the config folder. Please remove this file manually.')) ?>
|
||||||
|
</p>
|
||||||
|
</div>
|
|
@ -111,6 +111,13 @@ class Updater extends BasicEmitter {
|
||||||
$this->emit('\OC\Updater', 'maintenanceEnabled');
|
$this->emit('\OC\Updater', 'maintenanceEnabled');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear CAN_INSTALL file if not on git
|
||||||
|
if (\OC_Util::getChannel() !== 'git' && is_file(\OC::$configDir.'/CAN_INSTALL')) {
|
||||||
|
if (!unlink(\OC::$configDir . '/CAN_INSTALL')) {
|
||||||
|
$this->log->error('Could not cleanup CAN_INSTALL from your config folder. Please remove this file manually.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
|
$installedVersion = $this->config->getSystemValue('version', '0.0.0');
|
||||||
$currentVersion = implode('.', \OCP\Util::getVersion());
|
$currentVersion = implode('.', \OCP\Util::getVersion());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue