@@ -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($test=false) |
183 | 180 | { |
184 | - if ($this->trapDB != null && $test = false) return $this->trapDB; |
|
181 | + if ($this->trapDB != null && $test = false) { |
|
182 | + return $this->trapDB; |
|
183 | + } |
|
185 | 184 | |
186 | 185 | $dbresource=$this->trapController->Config()->get('config', 'database'); |
187 | 186 | |
@@ -207,7 +206,9 @@ discard block |
||
207 | 206 | */ |
208 | 207 | public function getIdoDb($test=false) |
209 | 208 | { |
210 | - if ($this->idoDB != null && $test === false) return $this->idoDB; |
|
209 | + if ($this->idoDB != null && $test === false) { |
|
210 | + return $this->idoDB; |
|
211 | + } |
|
211 | 212 | // TODO : get ido database directly from icingaweb2 config -> (or not if using only API) |
212 | 213 | $dbresource=$this->trapController->Config()->get('config', 'IDOdatabase');; |
213 | 214 | |
@@ -224,8 +225,7 @@ discard block |
||
224 | 225 | try |
225 | 226 | { |
226 | 227 | $dbconn = IcingaDbConnection::fromResourceName($dbresource); |
227 | - } |
|
228 | - catch (Exception $e) |
|
228 | + } catch (Exception $e) |
|
229 | 229 | { |
230 | 230 | if ($test === true) |
231 | 231 | { |
@@ -250,8 +250,7 @@ discard block |
||
250 | 250 | { |
251 | 251 | return array(4,"$dbresource does not look like an IDO database"); |
252 | 252 | } |
253 | - } |
|
254 | - catch (Exception $e) |
|
253 | + } catch (Exception $e) |
|
255 | 254 | { |
256 | 255 | throw new DBException( array(3,"Error connecting to $dbresource : " . $e->getMessage())); |
257 | 256 | } |