@@ -93,7 +93,8 @@ |
||
93 | 93 | try { |
94 | 94 | $mgdschemaclass = $this->__mgdschema_class_name__; |
95 | 95 | $this->__object = new $mgdschemaclass($id); |
96 | - } catch (mgd_exception $e) { |
|
96 | + } |
|
97 | + catch (mgd_exception $e) { |
|
97 | 98 | debug_add('Constructing ' . $this->__mgdschema_class_name__ . ' object ' . $id . ' failed, reason: ' . $e->getMessage(), MIDCOM_LOG_WARN); |
98 | 99 | throw new midcom_error_midgard($e, $id); |
99 | 100 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | if (is_object($id)) { |
107 | 107 | $this->__object = midcom::get()->dbfactory->convert_midcom_to_midgard($id); |
108 | 108 | } else { |
109 | - if ( is_int($id) |
|
109 | + if (is_int($id) |
|
110 | 110 | && $id < 1) { |
111 | 111 | throw new midcom_error($id . ' is not a valid database ID'); |
112 | 112 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | //Some useful information for performance tuning |
123 | - if ( midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
123 | + if (midcom::get()->config->get('log_level') >= MIDCOM_LOG_DEBUG |
|
124 | 124 | && $this->__object->guid) { |
125 | 125 | static $guids = []; |
126 | 126 | static $total = 0; |
@@ -94,7 +94,8 @@ |
||
94 | 94 | } |
95 | 95 | try { |
96 | 96 | $this->_storage = new midgard_group($id); |
97 | - } catch (Exception $e) { |
|
97 | + } |
|
98 | + catch (Exception $e) { |
|
98 | 99 | debug_add('Tried to load a midcom_core_group, but got error ' . $e->getMessage(), MIDCOM_LOG_ERROR); |
99 | 100 | debug_print_r('Passed argument was:', $id); |
100 | 101 | throw new midcom_error($e->getMessage()); |
@@ -27,7 +27,8 @@ |
||
27 | 27 | try { |
28 | 28 | midcom::get()->dbfactory->get_object_by_guid($result->fromGuid); |
29 | 29 | midcom::get()->dbfactory->get_object_by_guid($result->toGuid); |
30 | - } catch (midcom_error $e) { |
|
30 | + } |
|
31 | + catch (midcom_error $e) { |
|
31 | 32 | echo $i . "/" . $total . ": Deleting relatedto #" . $result->id . "\n"; |
32 | 33 | $result->delete(); |
33 | 34 | } |
@@ -28,7 +28,8 @@ |
||
28 | 28 | foreach ($qb->execute() as $feed) { |
29 | 29 | try { |
30 | 30 | midcom_db_topic::get_cached($feed->node); |
31 | - } catch (midcom_error $e) { |
|
31 | + } |
|
32 | + catch (midcom_error $e) { |
|
32 | 33 | debug_add("Node #{$feed->node} does not exist, skipping feed #{$feed->id}", MIDCOM_LOG_ERROR); |
33 | 34 | continue; |
34 | 35 | } |
@@ -32,7 +32,8 @@ |
||
32 | 32 | foreach ($qb->execute() as $article) { |
33 | 33 | try { |
34 | 34 | $dm->set_storage($article); |
35 | - } catch (midcom_error $e) { |
|
35 | + } |
|
36 | + catch (midcom_error $e) { |
|
36 | 37 | $e->log(MIDCOM_LOG_WARN); |
37 | 38 | continue; |
38 | 39 | } |
@@ -112,7 +112,8 @@ |
||
112 | 112 | foreach ($qb->execute() as $article) { |
113 | 113 | try { |
114 | 114 | $datamanager->set_storage($article); |
115 | - } catch (midcom_error $e) { |
|
115 | + } |
|
116 | + catch (midcom_error $e) { |
|
116 | 117 | $e->log(); |
117 | 118 | continue; |
118 | 119 | } |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if ( !$this->can_do('midgard:update') |
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | - MIDCOM_LOG_ERROR); |
|
221 | + MIDCOM_LOG_ERROR); |
|
222 | 222 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
223 | 223 | return false; |
224 | 224 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if ( !$this->can_do('midgard:update') |
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | - MIDCOM_LOG_ERROR); |
|
274 | + MIDCOM_LOG_ERROR); |
|
275 | 275 | midcom_connection::set_error(MGD_ERR_ACCESS_DENIED); |
276 | 276 | return false; |
277 | 277 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | debug_add('Cannot set parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
206 | 206 | return false; |
207 | 207 | } |
208 | - if ( empty($domain) |
|
208 | + if (empty($domain) |
|
209 | 209 | || empty($name) |
210 | 210 | || !is_string($domain) |
211 | 211 | || !is_string($name)) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | return false; |
216 | 216 | } |
217 | 217 | |
218 | - if ( !$this->can_do('midgard:update') |
|
218 | + if (!$this->can_do('midgard:update') |
|
219 | 219 | || !$this->can_do('midgard:parameters')) { |
220 | 220 | debug_add("Failed to set parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
221 | 221 | MIDCOM_LOG_ERROR); |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | debug_add('Cannot delete parameters on a non-persistent object.', MIDCOM_LOG_WARN); |
259 | 259 | return false; |
260 | 260 | } |
261 | - if ( empty($domain) |
|
261 | + if (empty($domain) |
|
262 | 262 | || empty($name) |
263 | 263 | || !is_string($domain) |
264 | 264 | || !is_string($name)) { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | return false; |
269 | 269 | } |
270 | 270 | |
271 | - if ( !$this->can_do('midgard:update') |
|
271 | + if (!$this->can_do('midgard:update') |
|
272 | 272 | || !$this->can_do('midgard:parameters')) { |
273 | 273 | debug_add("Failed to delete parameters, midgard:update or midgard:parameters on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
274 | 274 | MIDCOM_LOG_ERROR); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | |
66 | - if ( !$this->can_do('midgard:update') |
|
66 | + if (!$this->can_do('midgard:update') |
|
67 | 67 | || !$this->can_do('midgard:attachments')) { |
68 | 68 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
69 | 69 | MIDCOM_LOG_ERROR); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | return false; |
89 | 89 | } |
90 | 90 | |
91 | - if ( !$this->can_do('midgard:update') |
|
91 | + if (!$this->can_do('midgard:update') |
|
92 | 92 | || !$this->can_do('midgard:attachments')) { |
93 | 93 | debug_add("Failed to set parameters, midgard:update or midgard:attachments on the " . get_class($this) . " {$this->guid} not granted for the current user.", |
94 | 94 | MIDCOM_LOG_ERROR); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | $attachment->parentguid = $this->guid; |
103 | 103 | |
104 | 104 | if (!$attachment->create()) { |
105 | - debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
105 | + debug_add("Could not create the attachment '{$name}' for " . get_class($this) . " {$this->guid}: " . midcom_connection::get_error_string(), |
|
106 | 106 | MIDCOM_LOG_INFO); |
107 | 107 | return false; |
108 | 108 | } |
@@ -194,7 +194,7 @@ |
||
194 | 194 | return false; |
195 | 195 | } |
196 | 196 | |
197 | - if ( !empty($this->_old_username) |
|
197 | + if (!empty($this->_old_username) |
|
198 | 198 | && $this->_old_username !== $new_username) { |
199 | 199 | if (!$history = @unserialize($this->_person->get_parameter('midcom', 'username_history'))) { |
200 | 200 | $history = []; |