diff --git a/application/forms/Config/Authentication/LdapBackendForm.php b/application/forms/Config/Authentication/LdapBackendForm.php index 111824b9f..6eaea137c 100644 --- a/application/forms/Config/Authentication/LdapBackendForm.php +++ b/application/forms/Config/Authentication/LdapBackendForm.php @@ -136,7 +136,7 @@ class LdapBackendForm extends BaseBackendForm */ public function isValidAuthenticationBackend() { - if (! Platform::ldapAvailable()) { + if (! Platform::extensionLoaded('ldap')) { /* * It should be possible to run icingaweb without the php ldap extension, when * no ldap backends are needed. When the user tries to create an ldap backend diff --git a/application/forms/Config/ResourceForm.php b/application/forms/Config/ResourceForm.php index 9ac85fadc..de6be7699 100644 --- a/application/forms/Config/ResourceForm.php +++ b/application/forms/Config/ResourceForm.php @@ -406,14 +406,14 @@ class ResourceForm extends Form * in case they aren't actually used. When the user tries to create a resource that depends on an * uninstalled extension, an error should be displayed. */ - if ($config->db === 'mysql' && ! Platform::mysqlAvailable()) { + if ($config->db === 'mysql' && ! Platform::extensionLoaded('mysql')) { $this->addErrorMessage( t('You need to install the php extension "mysql" and the ' . 'Zend_Pdo_Mysql classes to use MySQL database resources.') ); return false; } - if ($config->db === 'pgsql' && ! Platform::pgsqlAvailable()) { + if ($config->db === 'pgsql' && ! Platform::extensionLoaded('pgsql')) { $this->addErrorMessage( t('You need to install the php extension "pgsql" and the ' . 'Zend_Pdo_Pgsql classes to use PostgreSQL database resources.') diff --git a/library/Icinga/Application/Platform.php b/library/Icinga/Application/Platform.php index 98f5acc44..1ca738741 100644 --- a/library/Icinga/Application/Platform.php +++ b/library/Icinga/Application/Platform.php @@ -121,32 +121,14 @@ class Platform } /** - * Test of php ldap support + * Test for php extension * - * @return bool - */ - public static function ldapAvailable() - { - return extension_loaded('ldap'); - } - - /** - * Test of php pgsql support + * @param string $extensionName E.g. mysql, ldap * - * @return bool + * @return bool */ - public static function pgsqlAvailable() + public static function extensionLoaded($extensionName) { - return extension_loaded('pgsql'); - } - - /** - * Test of php mysql support - * - * @return bool - */ - public static function mysqlAvailable() - { - return extension_loaded('mysql'); + return extension_loaded($extensionName); } }