diff options
author | Morris Jobke <hey@morrisjobke.de> | 2016-01-20 10:20:36 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2016-01-20 10:23:57 +0100 |
commit | 06fe4cabfc55a8ba4df954c871e6cff2fbbd67d2 (patch) | |
tree | 6f534702a772952b70c617a6ce508f4075a11082 /core/setup | |
parent | b97fe978753ca72412ad6d868a1c4cb3f53eb82e (diff) | |
download | nextcloud-server-06fe4cabfc55a8ba4df954c871e6cff2fbbd67d2.tar.gz nextcloud-server-06fe4cabfc55a8ba4df954c871e6cff2fbbd67d2.zip |
move setup controller to core/controller
Diffstat (limited to 'core/setup')
-rw-r--r-- | core/setup/controller.php | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/core/setup/controller.php b/core/setup/controller.php deleted file mode 100644 index a64e6f08a36..00000000000 --- a/core/setup/controller.php +++ /dev/null @@ -1,125 +0,0 @@ -<?php -/** - * @author Bart Visscher <bartv@thisnet.nl> - * @author ideaship <ideaship@users.noreply.github.com> - * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Robin Appelman <icewind@owncloud.com> - * @author Robin McCorkell <robin@mccorkell.me.uk> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @copyright Copyright (c) 2016, ownCloud, Inc. - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -namespace OC\Core\Setup; - -use OC\Setup; - -class Controller { - /** @var Setup */ - protected $setupHelper; - /** @var string */ - private $autoConfigFile; - - /** - * @param Setup $setupHelper - */ - function __construct(Setup $setupHelper) { - $this->autoConfigFile = \OC::$SERVERROOT.'/config/autoconfig.php'; - $this->setupHelper = $setupHelper; - } - - /** - * @param $post - */ - public function run($post) { - // Check for autosetup: - $post = $this->loadAutoConfig($post); - $opts = $this->setupHelper->getSystemInfo(); - - // convert 'abcpassword' to 'abcpass' - if (isset($post['adminpassword'])) { - $post['adminpass'] = $post['adminpassword']; - } - if (isset($post['dbpassword'])) { - $post['dbpass'] = $post['dbpassword']; - } - - if(isset($post['install']) AND $post['install']=='true') { - // We have to launch the installation process : - $e = $this->setupHelper->install($post); - $errors = array('errors' => $e); - - if(count($e) > 0) { - $options = array_merge($opts, $post, $errors); - $this->display($options); - } else { - $this->finishSetup(); - } - } else { - $options = array_merge($opts, $post); - $this->display($options); - } - } - - public function display($post) { - $defaults = array( - 'adminlogin' => '', - 'adminpass' => '', - 'dbuser' => '', - 'dbpass' => '', - 'dbname' => '', - 'dbtablespace' => '', - 'dbhost' => 'localhost', - 'dbtype' => '', - ); - $parameters = array_merge($defaults, $post); - - \OC_Util::addVendorScript('strengthify/jquery.strengthify'); - \OC_Util::addVendorStyle('strengthify/strengthify'); - \OC_Util::addScript('setup'); - \OC_Template::printGuestPage('', 'installation', $parameters); - } - - public function finishSetup() { - if( file_exists( $this->autoConfigFile )) { - unlink($this->autoConfigFile); - } - \OC_Util::redirectToDefaultPage(); - } - - public function loadAutoConfig($post) { - if( file_exists($this->autoConfigFile)) { - \OCP\Util::writeLog('core', 'Autoconfig file found, setting up ownCloud…', \OCP\Util::INFO); - $AUTOCONFIG = array(); - include $this->autoConfigFile; - $post = array_merge ($post, $AUTOCONFIG); - } - - $dbIsSet = isset($post['dbtype']); - $directoryIsSet = isset($post['directory']); - $adminAccountIsSet = isset($post['adminlogin']); - - if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { - $post['install'] = 'true'; - } - $post['dbIsSet'] = $dbIsSet; - $post['directoryIsSet'] = $directoryIsSet; - - return $post; - } -} |