@@ -111,8 +111,7 @@ discard block |
||
| 111 | 111 | $this->trapController->redirectNow('trapdirector/settings?dberror=5'); |
| 112 | 112 | return false; |
| 113 | 113 | } |
| 114 | - } |
|
| 115 | - catch (Exception $e) |
|
| 114 | + } catch (Exception $e) |
|
| 116 | 115 | { |
| 117 | 116 | if ($test === true) |
| 118 | 117 | { |
@@ -137,8 +136,7 @@ discard block |
||
| 137 | 136 | try |
| 138 | 137 | { |
| 139 | 138 | $dbconn = IcingaDbConnection::fromResourceName($DBname); |
| 140 | - } |
|
| 141 | - catch (Exception $e) |
|
| 139 | + } catch (Exception $e) |
|
| 142 | 140 | { |
| 143 | 141 | if ($test === true) |
| 144 | 142 | { |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | { |
| 153 | 151 | $dbAdapter=$dbconn->getDbAdapter(); |
| 154 | 152 | |
| 155 | - } |
|
| 156 | - catch (Exception $e) |
|
| 153 | + } catch (Exception $e) |
|
| 157 | 154 | { |
| 158 | 155 | if ($test === true) |
| 159 | 156 | { |
@@ -181,7 +178,9 @@ discard block |
||
| 181 | 178 | */ |
| 182 | 179 | public function getDb() |
| 183 | 180 | { |
| 184 | - if ( $this->trapDB != null ) return $this->trapDB; |
|
| 181 | + if ( $this->trapDB != null ) { |
|
| 182 | + return $this->trapDB; |
|
| 183 | + } |
|
| 185 | 184 | |
| 186 | 185 | $dbresource=$this->trapController->Config()->get('config', 'database'); |
| 187 | 186 | |
@@ -226,7 +225,9 @@ discard block |
||
| 226 | 225 | */ |
| 227 | 226 | public function getIdoDb($test=false) |
| 228 | 227 | { |
| 229 | - if ($this->idoDB != null && $test === false) return $this->idoDB; |
|
| 228 | + if ($this->idoDB != null && $test === false) { |
|
| 229 | + return $this->idoDB; |
|
| 230 | + } |
|
| 230 | 231 | // TODO : get ido database directly from icingaweb2 config -> (or not if using only API) |
| 231 | 232 | $dbresource=$this->trapController->Config()->get('config', 'IDOdatabase');; |
| 232 | 233 | |
@@ -239,8 +240,7 @@ discard block |
||
| 239 | 240 | try |
| 240 | 241 | { |
| 241 | 242 | $dbconn = IcingaDbConnection::fromResourceName($dbresource); |
| 242 | - } |
|
| 243 | - catch (Exception $e) |
|
| 243 | + } catch (Exception $e) |
|
| 244 | 244 | { |
| 245 | 245 | $this->redirectNow('trapdirector/settings?idodberror=2'); |
| 246 | 246 | return null; |
@@ -268,8 +268,7 @@ discard block |
||
| 268 | 268 | try |
| 269 | 269 | { |
| 270 | 270 | $dbconn = IcingaDbConnection::fromResourceName($dbresource); |
| 271 | - } |
|
| 272 | - catch (Exception $e) |
|
| 271 | + } catch (Exception $e) |
|
| 273 | 272 | { |
| 274 | 273 | throw new DBException( array(2,"Database $dbresource does not exists in IcingaWeb2") ); |
| 275 | 274 | } |
@@ -283,8 +282,7 @@ discard block |
||
| 283 | 282 | { |
| 284 | 283 | throw new DBException( array(4,"$dbresource does not look like an IDO database")); |
| 285 | 284 | } |
| 286 | - } |
|
| 287 | - catch (Exception $e) |
|
| 285 | + } catch (Exception $e) |
|
| 288 | 286 | { |
| 289 | 287 | throw new DBException( array(3,"Error connecting to $dbresource : " . $e->getMessage())); |
| 290 | 288 | } |