parent
c194c02435
commit
22e17e9901
|
@ -5,6 +5,7 @@
|
|||
namespace Icinga\Form\Config\Authentication;
|
||||
|
||||
use Exception;
|
||||
use Icinga\Application\Platform;
|
||||
use Zend_Config;
|
||||
use Icinga\Web\Form;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
|
@ -135,7 +136,7 @@ class LdapBackendForm extends BaseBackendForm
|
|||
*/
|
||||
public function isValidAuthenticationBackend()
|
||||
{
|
||||
if (! ResourceFactory::ldapAvailable()) {
|
||||
if (! Platform::ldapAvailable()) {
|
||||
/*
|
||||
* 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
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
namespace Icinga\Form\Config;
|
||||
|
||||
use Exception;
|
||||
use Icinga\Application\Platform;
|
||||
use Zend_Config;
|
||||
use Zend_Form_Element_Checkbox;
|
||||
use Icinga\Web\Form;
|
||||
|
@ -405,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' && !ResourceFactory::mysqlAvailable()) {
|
||||
if ($config->db === 'mysql' && ! Platform::mysqlAvailable()) {
|
||||
$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' && !ResourceFactory::pgsqlAvailable()) {
|
||||
if ($config->db === 'pgsql' && ! Platform::pgsqlAvailable()) {
|
||||
$this->addErrorMessage(
|
||||
t('You need to install the php extension "pgsql" and the ' .
|
||||
'Zend_Pdo_Pgsql classes to use PostgreSQL database resources.')
|
||||
|
|
|
@ -66,4 +66,19 @@ class Platform
|
|||
self::$domain = array_shift(preg_split('~\.~', self::$hostname, 2));
|
||||
}
|
||||
}
|
||||
|
||||
public static function ldapAvailable()
|
||||
{
|
||||
return extension_loaded('ldap');
|
||||
}
|
||||
|
||||
public static function pgsqlAvailable()
|
||||
{
|
||||
return extension_loaded('pgsql');
|
||||
}
|
||||
|
||||
public static function mysqlAvailable()
|
||||
{
|
||||
return extension_loaded('mysql');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,19 +121,4 @@ class ResourceFactory implements ConfigAwareFactory
|
|||
}
|
||||
return $resource;
|
||||
}
|
||||
|
||||
public static function ldapAvailable()
|
||||
{
|
||||
return extension_loaded('ldap');
|
||||
}
|
||||
|
||||
public static function pgsqlAvailable()
|
||||
{
|
||||
return extension_loaded('pgsql');
|
||||
}
|
||||
|
||||
public static function mysqlAvailable()
|
||||
{
|
||||
return extension_loaded('mysql');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,6 @@ class LdapBackendFormTest extends BaseTestCase
|
|||
protected function setUpResourceFactoryMock()
|
||||
{
|
||||
Mockery::mock('alias:Icinga\Data\ResourceFactory')
|
||||
->shouldReceive('ldapAvailable')
|
||||
->andReturn(true)
|
||||
->shouldReceive('getResourceConfig')
|
||||
->andReturn(new \Zend_Config(array()))
|
||||
->shouldReceive('createResource')
|
||||
|
|
|
@ -261,8 +261,6 @@ class ResourceFormTest extends BaseTestCase
|
|||
protected function setUpResourceFactoryMock($resourceMock)
|
||||
{
|
||||
Mockery::mock('alias:Icinga\Data\ResourceFactory')
|
||||
->shouldReceive('mysqlAvailable')
|
||||
->andReturn(true)
|
||||
->shouldReceive('createResource')
|
||||
->with(Mockery::type('\Zend_Config'))
|
||||
->andReturn($resourceMock);
|
||||
|
|
Loading…
Reference in New Issue