parent
2b14dbaff3
commit
ebf908b1b5
|
@ -29,10 +29,10 @@ class DbResourceForm extends Form
|
|||
public function createElements(array $formData)
|
||||
{
|
||||
$dbChoices = array();
|
||||
if (Platform::zendClassExists('Zend_Db_Adapter_Pdo_Mysql')) {
|
||||
if (Platform::hasMysqlSupport()) {
|
||||
$dbChoices['mysql'] = 'MySQL';
|
||||
}
|
||||
if (Platform::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql')) {
|
||||
if (Platform::hasPostgresqlSupport()) {
|
||||
$dbChoices['pgsql'] = 'PostgreSQL';
|
||||
}
|
||||
|
||||
|
|
|
@ -217,7 +217,7 @@ class ResourceConfigForm extends ConfigForm
|
|||
if ($resourceType === 'ldap' || Platform::extensionLoaded('ldap')) {
|
||||
$resourceTypes['ldap'] = 'LDAP';
|
||||
}
|
||||
if ($resourceType === 'db' || Platform::extensionLoaded('mysql') || Platform::extensionLoaded('pgsql')) {
|
||||
if ($resourceType === 'db' || Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
|
||||
$resourceTypes['db'] = t('SQL Database');
|
||||
}
|
||||
|
||||
|
|
|
@ -197,4 +197,28 @@ class Platform
|
|||
|
||||
return (@include str_replace('_', '/', $name) . '.php') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether it's possible to connect to a MySQL database
|
||||
*
|
||||
* Checks whether the mysql pdo extension has been loaded and the Zend framework adapter for MySQL is available
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasMysqlSupport()
|
||||
{
|
||||
return static::extensionLoaded('mysql') && static::zendClassExists('Zend_Db_Adapter_Pdo_Mysql');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether it's possible to connect to a PostgreSQL database
|
||||
*
|
||||
* Checks whether the pgsql pdo extension has been loaded and the Zend framework adapter for PostgreSQL is available
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function hasPostgresqlSupport()
|
||||
{
|
||||
return static::extensionLoaded('pgsql') && static::zendClassExists('Zend_Db_Adapter_Pdo_Pgsql');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ class BackendPage extends Form
|
|||
);
|
||||
|
||||
$resourceTypes = array();
|
||||
if (Platform::extensionLoaded('mysql') || Platform::extensionLoaded('pgsql')) {
|
||||
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
|
||||
$resourceTypes['ido'] = 'IDO';
|
||||
}
|
||||
$resourceTypes['livestatus'] = 'Livestatus';
|
||||
|
|
|
@ -49,7 +49,7 @@ class AuthenticationPage extends Form
|
|||
);
|
||||
|
||||
$backendTypes = array();
|
||||
if (Platform::extensionLoaded('mysql') || Platform::extensionLoaded('pgsql')) {
|
||||
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
|
||||
$backendTypes['db'] = t('Database');
|
||||
}
|
||||
if (Platform::extensionLoaded('ldap')) {
|
||||
|
|
|
@ -64,7 +64,7 @@ class PreferencesPage extends Form
|
|||
|
||||
$storageTypes = array();
|
||||
$storageTypes['ini'] = t('File System (INI Files)');
|
||||
if (Platform::extensionLoaded('mysql') || Platform::extensionLoaded('pgsql')) {
|
||||
if (Platform::hasMysqlSupport() || Platform::hasPostgresqlSupport()) {
|
||||
$storageTypes['db'] = t('Database');
|
||||
}
|
||||
$storageTypes['null'] = t('Don\'t Store Preferences');
|
||||
|
|
Loading…
Reference in New Issue