Skip to content
Snippets Groups Projects
Commit 4ed0a418 authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #12414 from owncloud/delay-autoconfig-kill-2

autoconfig.php only to be deleted on successful installation
parents c749570a b68c07d6
No related branches found
No related tags found
No related merge requests found
...@@ -12,13 +12,21 @@ namespace OC\Core\Setup; ...@@ -12,13 +12,21 @@ namespace OC\Core\Setup;
use OCP\IConfig; use OCP\IConfig;
class Controller { class Controller {
/** @var \OCP\IConfig */ /**
* @var \OCP\IConfig
*/
protected $config; protected $config;
/**
* @var string
*/
private $autoConfigFile;
/** /**
* @param IConfig $config * @param IConfig $config
*/ */
function __construct(IConfig $config) { function __construct(IConfig $config) {
$this->autoConfigFile = \OC::$SERVERROOT.'/config/autoconfig.php';
$this->config = $config; $this->config = $config;
} }
...@@ -64,15 +72,17 @@ class Controller { ...@@ -64,15 +72,17 @@ class Controller {
} }
public function finishSetup() { public function finishSetup() {
if( file_exists( $this->autoConfigFile )) {
unlink($this->autoConfigFile);
}
\OC_Util::redirectToDefaultPage(); \OC_Util::redirectToDefaultPage();
} }
public function loadAutoConfig($post) { public function loadAutoConfig($post) {
$autosetup_file = \OC::$SERVERROOT.'/config/autoconfig.php'; if( file_exists($this->autoConfigFile)) {
if( file_exists( $autosetup_file )) {
\OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', \OC_Log::INFO); \OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', \OC_Log::INFO);
$AUTOCONFIG = array(); $AUTOCONFIG = array();
include $autosetup_file; include $this->autoConfigFile;
$post = array_merge ($post, $AUTOCONFIG); $post = array_merge ($post, $AUTOCONFIG);
} }
...@@ -82,9 +92,6 @@ class Controller { ...@@ -82,9 +92,6 @@ class Controller {
if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) {
$post['install'] = 'true'; $post['install'] = 'true';
if( file_exists( $autosetup_file )) {
unlink($autosetup_file);
}
} }
$post['dbIsSet'] = $dbIsSet; $post['dbIsSet'] = $dbIsSet;
$post['directoryIsSet'] = $directoryIsSet; $post['directoryIsSet'] = $directoryIsSet;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment