Merge pull request #3643 from Icinga/feature/db-oracle-hostname-optional
DbConnection: Make host optional for Oracle connections
This commit is contained in:
commit
a95e645236
|
@ -58,6 +58,12 @@ class DbResourceForm extends Form
|
|||
$offerMysql = true;
|
||||
}
|
||||
|
||||
if ($dbChoice === 'oracle') {
|
||||
$hostIsRequired = false;
|
||||
} else {
|
||||
$hostIsRequired = true;
|
||||
}
|
||||
|
||||
$socketInfo = '';
|
||||
if ($offerPostgres) {
|
||||
$socketInfo = $this->translate(
|
||||
|
@ -104,7 +110,7 @@ class DbResourceForm extends Form
|
|||
'text',
|
||||
'host',
|
||||
array (
|
||||
'required' => true,
|
||||
'required' => $hostIsRequired,
|
||||
'label' => $this->translate('Host'),
|
||||
'description' => $this->translate('The hostname of the database')
|
||||
. ($socketInfo ? '. ' . $socketInfo : ''),
|
||||
|
|
|
@ -215,6 +215,11 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||
case 'oracle':
|
||||
$adapter = 'Pdo_Oci';
|
||||
$defaultPort = 1521;
|
||||
|
||||
// remove host parameter when not configured
|
||||
if (empty($this->config->host)) {
|
||||
unset($adapterParamaters['host']);
|
||||
}
|
||||
break;
|
||||
case 'pgsql':
|
||||
$adapter = 'Pdo_Pgsql';
|
||||
|
@ -555,7 +560,7 @@ class DbConnection implements Selectable, Extensible, Updatable, Reducible, Insp
|
|||
'Connection to %s as %s on %s:%s successful',
|
||||
$config['dbname'],
|
||||
$config['username'],
|
||||
$config['host'],
|
||||
array_key_exists('host', $config) ? $config['host'] : '(none)',
|
||||
$config['port']
|
||||
));
|
||||
switch ($this->dbType) {
|
||||
|
|
Loading…
Reference in New Issue