From d8ec7e270167594ed407b22cb9ae78b1501ca946 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Fri, 31 Jan 2014 17:31:19 +0100 Subject: [PATCH] DRY for database type radiolist --- core/setup/controller.php | 17 +++++++++ core/templates/installation.php | 62 +++++---------------------------- 2 files changed, 25 insertions(+), 54 deletions(-) diff --git a/core/setup/controller.php b/core/setup/controller.php index 5189aba2f34..c628bda609b 100644 --- a/core/setup/controller.php +++ b/core/setup/controller.php @@ -85,6 +85,22 @@ class Controller { $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'; + } + if ($hasPostgreSQL) { + $databases['pgsql'] = 'PostgreSQL'; + } + if ($hasOracle) { + $databases['oci'] = 'Oracle'; + } + if ($hasMSSQL) { + $databases['mssql'] = 'MS SQL'; + } $datadir = \OC_Config::getValue('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) @@ -111,6 +127,7 @@ class Controller { 'hasPostgreSQL' => $hasPostgreSQL, 'hasOracle' => $hasOracle, 'hasMSSQL' => $hasMSSQL, + 'databases' => $databases, 'directory' => $datadir, 'secureRNG' => \OC_Util::secureRNGAvailable(), 'htaccessWorking' => $htaccessWorking, diff --git a/core/templates/installation.php b/core/templates/installation.php index 7e216d0ee99..9356e62aa6c 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -86,62 +86,16 @@ $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> t( 'Configure the database' )); ?>
- - - -

SQLite t( 'will be used' )); ?>.

- + $label): ?> + +

t( 'will be used' )); ?>.

+ - /> - - - - - - - -

MySQL t( 'will be used' )); ?>.

- - - /> - - - - - - -

PostgreSQL t( 'will be used' )); ?>.

- - - - /> - - - - - -

Oracle t( 'will be used' )); ?>.

- - - - /> - - - - - - -

MS SQL t( 'will be used' )); ?>.

- - - - /> - + /> + +
-- 2.39.5