summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2014-10-27 22:24:16 +0100
committerLukas Reschke <lukas@owncloud.com>2014-10-27 22:24:16 +0100
commitd6380a53955e4de1a69e0a645821a7424e44135e (patch)
tree8529f9c75f1fd5e931fd0fb29366522d34ce27e3 /core
parenta00712aa65169b248cac8e541dfe69fd82082609 (diff)
parent79778d6a5118f3d024d1d4c1e001fba8fba13423 (diff)
downloadnextcloud-server-d6380a53955e4de1a69e0a645821a7424e44135e.tar.gz
nextcloud-server-d6380a53955e4de1a69e0a645821a7424e44135e.zip
Merge pull request #11786 from owncloud/MakeSupportedDBsConfigurable
Make supported DBs configurable within config.php
Diffstat (limited to 'core')
-rw-r--r--core/setup/controller.php63
1 files changed, 29 insertions, 34 deletions
diff --git a/core/setup/controller.php b/core/setup/controller.php
index 53f247e9769..f5f05348fd1 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;
@@ -119,25 +114,25 @@ class Controller {
// Create data directory to test whether the .htaccess works
// Notice that this is not necessarily the same data directory as the one
// that will effectively be used.
- @mkdir($datadir);
- if (is_dir($datadir) && is_writable($datadir)) {
+ @mkdir($dataDir);
+ $htAccessWorking = true;
+ if (is_dir($dataDir) && is_writable($dataDir)) {
// Protect data directory here, so we can test if the protection is working
\OC_Setup::protectDataDirectory();
try {
- $htaccessWorking = \OC_Util::isHtaccessWorking();
+ $htAccessWorking = \OC_Util::isHtaccessWorking();
} catch (\OC\HintException $e) {
$errors[] = array(
'error' => $e->getMessage(),
'hint' => $e->getHint()
);
- $htaccessWorking = false;
+ $htAccessWorking = false;
}
}
if (\OC_Util::runningOnMac()) {
$l10n = \OC::$server->getL10N('core');
- $themeName = \OC_Util::getTheme();
$theme = new \OC_Defaults();
$errors[] = array(
'error' => $l10n->t(
@@ -150,14 +145,14 @@ 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,
+ 'directory' => $dataDir,
+ 'htaccessWorking' => $htAccessWorking,
'vulnerableToNullByte' => $vulnerableToNullByte,
'errors' => $errors,
);