diff options
author | Lukas Reschke <lukas@owncloud.com> | 2014-10-27 12:51:26 +0100 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2014-10-27 21:39:34 +0100 |
commit | 233c49f4b9fc90f5bd023420ed899439fb413db0 (patch) | |
tree | b0df628bd066ae1337a803b476026b5c48b2549f /core | |
parent | 25a4b5a93581800887fceef7444b0d3702e4f018 (diff) | |
download | nextcloud-server-233c49f4b9fc90f5bd023420ed899439fb413db0.tar.gz nextcloud-server-233c49f4b9fc90f5bd023420ed899439fb413db0.zip |
Make supported DBs configurable within config.php
This commit will make the supported DBs for installation configurable within config.php. By default the following databases are tested: "sqlite", "mysql", "pgsql". The reason behind this is that there might be instances where we want to prevent SQLite to be used by mistake.
To test this play around with the new configuration parameter "supportedDatabases".
Diffstat (limited to 'core')
-rw-r--r-- | core/setup/controller.php | 49 |
1 files changed, 22 insertions, 27 deletions
diff --git a/core/setup/controller.php b/core/setup/controller.php index 53f247e9769..628a4b0349f 100644 --- a/core/setup/controller.php +++ b/core/setup/controller.php @@ -1,6 +1,7 @@ <?php /** * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> + * Copyright (c) 2014 Lukas Reschke <lukas@owncloud.com> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -8,7 +9,19 @@ namespace OC\Core\Setup; +use OCP\IConfig; + class Controller { + /** @var \OCP\IConfig */ + protected $config; + + /** + * @param IConfig $config + */ + function __construct(IConfig $config) { + $this->config = $config; + } + public function run($post) { // Check for autosetup: $post = $this->loadAutoConfig($post); @@ -87,28 +100,10 @@ class Controller { * in case of errors/warnings */ public function getSystemInfo() { - $hasSQLite = class_exists('SQLite3'); - $hasMySQL = is_callable('mysql_connect'); - $hasPostgreSQL = is_callable('pg_connect'); - $hasOracle = is_callable('oci_connect'); - $hasMSSQL = is_callable('sqlsrv_connect'); - $databases = array(); - if ($hasSQLite) { - $databases['sqlite'] = 'SQLite'; - } - if ($hasMySQL) { - $databases['mysql'] = 'MySQL/MariaDB'; - } - if ($hasPostgreSQL) { - $databases['pgsql'] = 'PostgreSQL'; - } - if ($hasOracle) { - $databases['oci'] = 'Oracle'; - } - if ($hasMSSQL) { - $databases['mssql'] = 'MS SQL'; - } - $datadir = \OC_Config::getValue('datadirectory', \OC::$SERVERROOT.'/data'); + $setup = new \OC_Setup($this->config); + $databases = $setup->getSupportedDatabases(); + + $datadir = $this->config->getSystemValue('datadirectory', \OC::$SERVERROOT.'/data'); $vulnerableToNullByte = false; if(@file_exists(__FILE__."\0Nullbyte")) { // Check if the used PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243) $vulnerableToNullByte = true; @@ -150,11 +145,11 @@ class Controller { } return array( - 'hasSQLite' => $hasSQLite, - 'hasMySQL' => $hasMySQL, - 'hasPostgreSQL' => $hasPostgreSQL, - 'hasOracle' => $hasOracle, - 'hasMSSQL' => $hasMSSQL, + 'hasSQLite' => isset($databases['sqlite']), + 'hasMySQL' => isset($databases['mysql']), + 'hasPostgreSQL' => isset($databases['postgre']), + 'hasOracle' => isset($databases['oci']), + 'hasMSSQL' => isset($databases['mssql']), 'databases' => $databases, 'directory' => $datadir, 'htaccessWorking' => $htaccessWorking, |