Index: trunk/extensions/EducationProgram/includes/DBTable.php |
— | — | @@ -103,11 +103,12 @@ |
104 | 104 | * @param array|string|null $fields |
105 | 105 | * @param array $conditions |
106 | 106 | * @param array $options |
| 107 | + * @param string|null $functionName |
107 | 108 | * |
108 | 109 | * @return array of self |
109 | 110 | */ |
110 | | - public function select( $fields = null, array $conditions = array(), array $options = array() ) { |
111 | | - $result = $this->selectFields( $fields, $conditions, $options, false ); |
| 111 | + public function select( $fields = null, array $conditions = array(), array $options = array(), $functionName = null ) { |
| 112 | + $result = $this->selectFields( $fields, $conditions, $options, false, $functionName ); |
112 | 113 | |
113 | 114 | $objects = array(); |
114 | 115 | |
— | — | @@ -136,10 +137,11 @@ |
137 | 138 | * @param array $conditions |
138 | 139 | * @param array $options |
139 | 140 | * @param boolean $collapse Set to false to always return each result row as associative array. |
| 141 | + * @param string|null $functionName |
140 | 142 | * |
141 | 143 | * @return array of array |
142 | 144 | */ |
143 | | - public function selectFields( $fields = null, array $conditions = array(), array $options = array(), $collapse = true ) { |
| 145 | + public function selectFields( $fields = null, array $conditions = array(), array $options = array(), $collapse = true, $functionName = null ) { |
144 | 146 | if ( is_null( $fields ) ) { |
145 | 147 | $fields = array_keys( $this->getFieldTypes() ); |
146 | 148 | } |
— | — | @@ -152,7 +154,7 @@ |
153 | 155 | $this->getDBTable(), |
154 | 156 | $this->getPrefixedFields( $fields ), |
155 | 157 | $this->getPrefixedValues( $conditions ), |
156 | | - __METHOD__, |
| 158 | + is_null( $functionName ) ? __METHOD__ : $functionName, |
157 | 159 | $options |
158 | 160 | ); |
159 | 161 | |
— | — | @@ -189,13 +191,14 @@ |
190 | 192 | * @param array|string|null $fields |
191 | 193 | * @param array $conditions |
192 | 194 | * @param array $options |
| 195 | + * @param string|null $functionName |
193 | 196 | * |
194 | 197 | * @return DBObject|bool False on failure |
195 | 198 | */ |
196 | | - public function selectRow( $fields = null, array $conditions = array(), array $options = array() ) { |
| 199 | + public function selectRow( $fields = null, array $conditions = array(), array $options = array(), $functionName = null ) { |
197 | 200 | $options['LIMIT'] = 1; |
198 | 201 | |
199 | | - $objects = $this->select( $fields, $conditions, $options ); |
| 202 | + $objects = $this->select( $fields, $conditions, $options, $functionName ); |
200 | 203 | |
201 | 204 | return empty( $objects ) ? false : $objects[0]; |
202 | 205 | } |
— | — | @@ -209,17 +212,18 @@ |
210 | 213 | * @param array $fields |
211 | 214 | * @param array $conditions |
212 | 215 | * @param array $options |
| 216 | + * @param string|null $functionName |
213 | 217 | * |
214 | 218 | * @return ResultWrapper |
215 | 219 | */ |
216 | | - public function rawSelectRow( array $fields, array $conditions = array(), array $options = array() ) { |
| 220 | + public function rawSelectRow( array $fields, array $conditions = array(), array $options = array(), $functionName = null ) { |
217 | 221 | $dbr = wfGetDB( $this->getReadDb() ); |
218 | 222 | |
219 | 223 | return $dbr->selectRow( |
220 | 224 | $this->getDBTable(), |
221 | 225 | $fields, |
222 | 226 | $conditions, |
223 | | - __METHOD__, |
| 227 | + is_null( $functionName ) ? __METHOD__ : $functionName, |
224 | 228 | $options |
225 | 229 | ); |
226 | 230 | } |
— | — | @@ -237,13 +241,14 @@ |
238 | 242 | * @param array $conditions |
239 | 243 | * @param array $options |
240 | 244 | * @param boolean $collapse Set to false to always return each result row as associative array. |
| 245 | + * @param string|null $functionName |
241 | 246 | * |
242 | 247 | * @return mixed|array|bool False on failure |
243 | 248 | */ |
244 | | - public function selectFieldsRow( $fields = null, array $conditions = array(), array $options = array(), $collapse = true ) { |
| 249 | + public function selectFieldsRow( $fields = null, array $conditions = array(), array $options = array(), $collapse = true, $functionName = null ) { |
245 | 250 | $options['LIMIT'] = 1; |
246 | 251 | |
247 | | - $objects = $this->selectFields( $fields, $conditions, $options, $collapse ); |
| 252 | + $objects = $this->selectFields( $fields, $conditions, $options, $collapse, $functionName ); |
248 | 253 | |
249 | 254 | return empty( $objects ) ? false : $objects[0]; |
250 | 255 | } |
— | — | @@ -292,13 +297,15 @@ |
293 | 298 | * @since 1.20 |
294 | 299 | * |
295 | 300 | * @param array $conditions |
| 301 | + * @param string|null $functionName |
296 | 302 | * |
297 | 303 | * @return boolean Success indicator |
298 | 304 | */ |
299 | | - public function delete( array $conditions ) { |
| 305 | + public function delete( array $conditions, $functionName = null ) { |
300 | 306 | return wfGetDB( DB_MASTER )->delete( |
301 | 307 | $this->getDBTable(), |
302 | | - $this->getPrefixedValues( $conditions ) |
| 308 | + $this->getPrefixedValues( $conditions ), |
| 309 | + $functionName |
303 | 310 | ); |
304 | 311 | } |
305 | 312 | |
Index: trunk/extensions/EducationProgram/includes/DBDataObject.php |
— | — | @@ -336,13 +336,15 @@ |
337 | 337 | * |
338 | 338 | * @since 1.20 |
339 | 339 | * |
| 340 | + * @param string|null $functionName |
| 341 | + * |
340 | 342 | * @return boolean Success indicator |
341 | 343 | */ |
342 | | - public function save() { |
| 344 | + public function save( $functionName = null ) { |
343 | 345 | if ( $this->hasIdField() ) { |
344 | | - return $this->saveExisting(); |
| 346 | + return $this->saveExisting( $functionName ); |
345 | 347 | } else { |
346 | | - return $this->insert(); |
| 348 | + return $this->insert( $functionName ); |
347 | 349 | } |
348 | 350 | } |
349 | 351 | |
— | — | @@ -351,16 +353,18 @@ |
352 | 354 | * |
353 | 355 | * @since 1.20 |
354 | 356 | * |
| 357 | + * @param string|null $functionName |
| 358 | + * |
355 | 359 | * @return boolean Success indicator |
356 | 360 | */ |
357 | | - protected function saveExisting() { |
| 361 | + protected function saveExisting( $functionName = null ) { |
358 | 362 | $dbw = wfGetDB( DB_MASTER ); |
359 | 363 | |
360 | 364 | $success = $dbw->update( |
361 | 365 | $this->table->getDBTable(), |
362 | 366 | $this->getWriteValues(), |
363 | 367 | array( $this->table->getPrefixedField( 'id' ) => $this->getId() ), |
364 | | - __METHOD__ |
| 368 | + is_null( $functionName ) ? __METHOD__ : $functionName |
365 | 369 | ); |
366 | 370 | |
367 | 371 | return $success; |
— | — | @@ -371,16 +375,19 @@ |
372 | 376 | * |
373 | 377 | * @since 1.20 |
374 | 378 | * |
| 379 | + * @param string|null $functionName |
| 380 | + * @param array|null $options |
| 381 | + * |
375 | 382 | * @return boolean Success indicator |
376 | 383 | */ |
377 | | - protected function insert() { |
| 384 | + protected function insert( $functionName = null, array $options = null ) { |
378 | 385 | $dbw = wfGetDB( DB_MASTER ); |
379 | 386 | |
380 | 387 | $result = $dbw->insert( |
381 | 388 | $this->table->getDBTable(), |
382 | 389 | $this->getWriteValues(), |
383 | | - __METHOD__, |
384 | | - array( 'IGNORE' ) |
| 390 | + is_null( $functionName ) ? __METHOD__ : $functionName, |
| 391 | + is_null( $options ) ? array( 'IGNORE' ) : $options |
385 | 392 | ); |
386 | 393 | |
387 | 394 | if ( $result ) { |
Index: trunk/extensions/EducationProgram/includes/EPPageObject.php |
— | — | @@ -58,13 +58,13 @@ |
59 | 59 | * (non-PHPdoc) |
60 | 60 | * @see DBDataObject::save() |
61 | 61 | */ |
62 | | - public function save() { |
| 62 | + public function save( $functionName = null ) { |
63 | 63 | if ( $this->hasField( $this->table->getIdentifierField() ) && is_null( $this->getTitle() ) ) { |
64 | 64 | throw new MWException( 'The title for a EPPageObject needs to be valid when saving.' ); |
65 | 65 | return false; |
66 | 66 | } |
67 | 67 | |
68 | | - return parent::save(); |
| 68 | + return parent::save( $functionName ); |
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -98,12 +98,12 @@ |
99 | 99 | * (non-PHPdoc) |
100 | 100 | * @see DBDataObject::save() |
101 | 101 | */ |
102 | | - public function save() { |
| 102 | + public function save( $functionName = null ) { |
103 | 103 | if ( $this->hasField( 'name' ) ) { |
104 | 104 | $this->setField( 'name', $GLOBALS['wgLang']->ucfirst( $this->getField( 'name' ) ) ); |
105 | 105 | } |
106 | 106 | |
107 | | - return parent::save(); |
| 107 | + return parent::save( $functionName ); |
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
Index: trunk/extensions/EducationProgram/includes/EPRevisionedObject.php |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | * (non-PHPdoc) |
136 | 136 | * @see DBDataObject::saveExisting() |
137 | 137 | */ |
138 | | - protected function saveExisting() { |
| 138 | + protected function saveExisting( $functionName = null ) { |
139 | 139 | if ( !$this->inSummaryMode ) { |
140 | 140 | $this->table->setReadDb( DB_MASTER ); |
141 | 141 | $originalObject = $this->table->selectRow( null, array( 'id' => $this->getId() ) ); |
— | — | @@ -148,7 +148,7 @@ |
149 | 149 | $success = true; |
150 | 150 | |
151 | 151 | if ( $this->inSummaryMode || $this->fieldsChanged( $originalObject, true ) ) { |
152 | | - $success = parent::saveExisting(); |
| 152 | + $success = parent::saveExisting( $functionName ); |
153 | 153 | |
154 | 154 | if ( $success && !$this->inSummaryMode ) { |
155 | 155 | $this->onUpdated( $originalObject ); |
— | — | @@ -175,8 +175,8 @@ |
176 | 176 | * (non-PHPdoc) |
177 | 177 | * @see DBDataObject::insert() |
178 | 178 | */ |
179 | | - protected function insert() { |
180 | | - $result = parent::insert(); |
| 179 | + protected function insert( $functionName = null, array $options = null ) { |
| 180 | + $result = parent::insert( $functionName, $options ); |
181 | 181 | |
182 | 182 | if ( $result ) { |
183 | 183 | $this->storeRevision( $this ); |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -120,8 +120,8 @@ |
121 | 121 | * (non-PHPdoc) |
122 | 122 | * @see DBDataObject::insert() |
123 | 123 | */ |
124 | | - protected function insert() { |
125 | | - $success = parent::insert(); |
| 124 | + protected function insert( $functionName = null, array $options = null ) { |
| 125 | + $success = parent::insert( $functionName, $options ); |
126 | 126 | |
127 | 127 | if ( $success && $this->updateSummaries ) { |
128 | 128 | EPOrgs::singleton()->updateSummaryFields( array( 'course_count', 'active' ), array( 'id' => $this->getField( 'org_id' ) ) ); |
— | — | @@ -217,7 +217,7 @@ |
218 | 218 | * (non-PHPdoc) |
219 | 219 | * @see DBDataObject::save() |
220 | 220 | */ |
221 | | - public function save() { |
| 221 | + public function save( $functionName = null ) { |
222 | 222 | if ( $this->hasField( 'name' ) ) { |
223 | 223 | $this->setField( 'name', $GLOBALS['wgLang']->ucfirst( $this->getField( 'name' ) ) ); |
224 | 224 | } |
— | — | @@ -229,7 +229,7 @@ |
230 | 230 | } |
231 | 231 | } |
232 | 232 | |
233 | | - return parent::save(); |
| 233 | + return parent::save( $functionName ); |
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |