@@ -33,95 +33,95 @@ |
||
| 33 | 33 | use OCP\ILogger; |
| 34 | 34 | |
| 35 | 35 | class SetupController { |
| 36 | - /** @var Setup */ |
|
| 37 | - protected $setupHelper; |
|
| 38 | - /** @var string */ |
|
| 39 | - private $autoConfigFile; |
|
| 36 | + /** @var Setup */ |
|
| 37 | + protected $setupHelper; |
|
| 38 | + /** @var string */ |
|
| 39 | + private $autoConfigFile; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * @param Setup $setupHelper |
|
| 43 | - */ |
|
| 44 | - function __construct(Setup $setupHelper) { |
|
| 45 | - $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
| 46 | - $this->setupHelper = $setupHelper; |
|
| 47 | - } |
|
| 41 | + /** |
|
| 42 | + * @param Setup $setupHelper |
|
| 43 | + */ |
|
| 44 | + function __construct(Setup $setupHelper) { |
|
| 45 | + $this->autoConfigFile = \OC::$configDir.'autoconfig.php'; |
|
| 46 | + $this->setupHelper = $setupHelper; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @param $post |
|
| 51 | - */ |
|
| 52 | - public function run($post) { |
|
| 53 | - // Check for autosetup: |
|
| 54 | - $post = $this->loadAutoConfig($post); |
|
| 55 | - $opts = $this->setupHelper->getSystemInfo(); |
|
| 49 | + /** |
|
| 50 | + * @param $post |
|
| 51 | + */ |
|
| 52 | + public function run($post) { |
|
| 53 | + // Check for autosetup: |
|
| 54 | + $post = $this->loadAutoConfig($post); |
|
| 55 | + $opts = $this->setupHelper->getSystemInfo(); |
|
| 56 | 56 | |
| 57 | - // convert 'abcpassword' to 'abcpass' |
|
| 58 | - if (isset($post['adminpassword'])) { |
|
| 59 | - $post['adminpass'] = $post['adminpassword']; |
|
| 60 | - } |
|
| 61 | - if (isset($post['dbpassword'])) { |
|
| 62 | - $post['dbpass'] = $post['dbpassword']; |
|
| 63 | - } |
|
| 57 | + // convert 'abcpassword' to 'abcpass' |
|
| 58 | + if (isset($post['adminpassword'])) { |
|
| 59 | + $post['adminpass'] = $post['adminpassword']; |
|
| 60 | + } |
|
| 61 | + if (isset($post['dbpassword'])) { |
|
| 62 | + $post['dbpass'] = $post['dbpassword']; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - if(isset($post['install']) AND $post['install']=='true') { |
|
| 66 | - // We have to launch the installation process : |
|
| 67 | - $e = $this->setupHelper->install($post); |
|
| 68 | - $errors = array('errors' => $e); |
|
| 65 | + if(isset($post['install']) AND $post['install']=='true') { |
|
| 66 | + // We have to launch the installation process : |
|
| 67 | + $e = $this->setupHelper->install($post); |
|
| 68 | + $errors = array('errors' => $e); |
|
| 69 | 69 | |
| 70 | - if(count($e) > 0) { |
|
| 71 | - $options = array_merge($opts, $post, $errors); |
|
| 72 | - $this->display($options); |
|
| 73 | - } else { |
|
| 74 | - $this->finishSetup(); |
|
| 75 | - } |
|
| 76 | - } else { |
|
| 77 | - $options = array_merge($opts, $post); |
|
| 78 | - $this->display($options); |
|
| 79 | - } |
|
| 80 | - } |
|
| 70 | + if(count($e) > 0) { |
|
| 71 | + $options = array_merge($opts, $post, $errors); |
|
| 72 | + $this->display($options); |
|
| 73 | + } else { |
|
| 74 | + $this->finishSetup(); |
|
| 75 | + } |
|
| 76 | + } else { |
|
| 77 | + $options = array_merge($opts, $post); |
|
| 78 | + $this->display($options); |
|
| 79 | + } |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - public function display($post) { |
|
| 83 | - $defaults = array( |
|
| 84 | - 'adminlogin' => '', |
|
| 85 | - 'adminpass' => '', |
|
| 86 | - 'dbuser' => '', |
|
| 87 | - 'dbpass' => '', |
|
| 88 | - 'dbname' => '', |
|
| 89 | - 'dbtablespace' => '', |
|
| 90 | - 'dbhost' => 'localhost', |
|
| 91 | - 'dbtype' => '', |
|
| 92 | - ); |
|
| 93 | - $parameters = array_merge($defaults, $post); |
|
| 82 | + public function display($post) { |
|
| 83 | + $defaults = array( |
|
| 84 | + 'adminlogin' => '', |
|
| 85 | + 'adminpass' => '', |
|
| 86 | + 'dbuser' => '', |
|
| 87 | + 'dbpass' => '', |
|
| 88 | + 'dbname' => '', |
|
| 89 | + 'dbtablespace' => '', |
|
| 90 | + 'dbhost' => 'localhost', |
|
| 91 | + 'dbtype' => '', |
|
| 92 | + ); |
|
| 93 | + $parameters = array_merge($defaults, $post); |
|
| 94 | 94 | |
| 95 | - \OC_Util::addScript('setup'); |
|
| 96 | - \OC_Template::printGuestPage('', 'installation', $parameters); |
|
| 97 | - } |
|
| 95 | + \OC_Util::addScript('setup'); |
|
| 96 | + \OC_Template::printGuestPage('', 'installation', $parameters); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public function finishSetup() { |
|
| 100 | - if( file_exists( $this->autoConfigFile )) { |
|
| 101 | - unlink($this->autoConfigFile); |
|
| 102 | - } |
|
| 103 | - \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
| 104 | - \OC_Util::redirectToDefaultPage(); |
|
| 105 | - } |
|
| 99 | + public function finishSetup() { |
|
| 100 | + if( file_exists( $this->autoConfigFile )) { |
|
| 101 | + unlink($this->autoConfigFile); |
|
| 102 | + } |
|
| 103 | + \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
|
| 104 | + \OC_Util::redirectToDefaultPage(); |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - public function loadAutoConfig($post) { |
|
| 108 | - if( file_exists($this->autoConfigFile)) { |
|
| 109 | - \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
| 110 | - $AUTOCONFIG = array(); |
|
| 111 | - include $this->autoConfigFile; |
|
| 112 | - $post = array_merge ($post, $AUTOCONFIG); |
|
| 113 | - } |
|
| 107 | + public function loadAutoConfig($post) { |
|
| 108 | + if( file_exists($this->autoConfigFile)) { |
|
| 109 | + \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
|
| 110 | + $AUTOCONFIG = array(); |
|
| 111 | + include $this->autoConfigFile; |
|
| 112 | + $post = array_merge ($post, $AUTOCONFIG); |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - $dbIsSet = isset($post['dbtype']); |
|
| 116 | - $directoryIsSet = isset($post['directory']); |
|
| 117 | - $adminAccountIsSet = isset($post['adminlogin']); |
|
| 115 | + $dbIsSet = isset($post['dbtype']); |
|
| 116 | + $directoryIsSet = isset($post['directory']); |
|
| 117 | + $adminAccountIsSet = isset($post['adminlogin']); |
|
| 118 | 118 | |
| 119 | - if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
| 120 | - $post['install'] = 'true'; |
|
| 121 | - } |
|
| 122 | - $post['dbIsSet'] = $dbIsSet; |
|
| 123 | - $post['directoryIsSet'] = $directoryIsSet; |
|
| 119 | + if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { |
|
| 120 | + $post['install'] = 'true'; |
|
| 121 | + } |
|
| 122 | + $post['dbIsSet'] = $dbIsSet; |
|
| 123 | + $post['directoryIsSet'] = $directoryIsSet; |
|
| 124 | 124 | |
| 125 | - return $post; |
|
| 126 | - } |
|
| 125 | + return $post; |
|
| 126 | + } |
|
| 127 | 127 | } |
@@ -62,12 +62,12 @@ discard block |
||
| 62 | 62 | $post['dbpass'] = $post['dbpassword']; |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - if(isset($post['install']) AND $post['install']=='true') { |
|
| 65 | + if (isset($post['install']) AND $post['install'] == 'true') { |
|
| 66 | 66 | // We have to launch the installation process : |
| 67 | 67 | $e = $this->setupHelper->install($post); |
| 68 | 68 | $errors = array('errors' => $e); |
| 69 | 69 | |
| 70 | - if(count($e) > 0) { |
|
| 70 | + if (count($e) > 0) { |
|
| 71 | 71 | $options = array_merge($opts, $post, $errors); |
| 72 | 72 | $this->display($options); |
| 73 | 73 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | public function finishSetup() { |
| 100 | - if( file_exists( $this->autoConfigFile )) { |
|
| 100 | + if (file_exists($this->autoConfigFile)) { |
|
| 101 | 101 | unlink($this->autoConfigFile); |
| 102 | 102 | } |
| 103 | 103 | \OC::$server->getIntegrityCodeChecker()->runInstanceVerification(); |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function loadAutoConfig($post) { |
| 108 | - if( file_exists($this->autoConfigFile)) { |
|
| 108 | + if (file_exists($this->autoConfigFile)) { |
|
| 109 | 109 | \OCP\Util::writeLog('core', 'Autoconfig file found, setting up Nextcloud…', ILogger::INFO); |
| 110 | 110 | $AUTOCONFIG = array(); |
| 111 | 111 | include $this->autoConfigFile; |
| 112 | - $post = array_merge ($post, $AUTOCONFIG); |
|
| 112 | + $post = array_merge($post, $AUTOCONFIG); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $dbIsSet = isset($post['dbtype']); |