From 32cab8ed69e3d197108ca24533c42aeb292215ba Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 2 May 2014 22:11:14 +0200 Subject: also validate database types --- config/appconfig.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'config') diff --git a/config/appconfig.php b/config/appconfig.php index 1a2367c4b..44932f693 100644 --- a/config/appconfig.php +++ b/config/appconfig.php @@ -161,12 +161,22 @@ class AppConfig { * @throws \OCA\News\DependencyException if one version is not satisfied */ public function testDependencies() { + $msg = ''; + + // test databases + if(array_key_exists('databases', $this->config)) { + if(!in_array($this->databaseType, $this->config['databases'])) { + $msg .= 'Database ' . $this->databaseType . ' not supported.' . + 'App is only compatible with ' . + implode(', ', $this->config['databases']); + } + } + + // test dependencies if(array_key_exists('dependencies', $this->config)) { $deps = $this->config['dependencies']; - $msg = ''; - if(array_key_exists('php', $deps)) { $msg .= $this->requireVersion($this->phpVersion, $deps['php'], 'PHP'); @@ -198,11 +208,10 @@ class AppConfig { } } } + } - if($msg !== '') { - throw new DependencyException($msg); - } - + if($msg !== '') { + throw new DependencyException($msg); } } -- cgit v1.2.3