| Index: trunk/extensions/EducationProgram/actions/EPEditAction.php |
| — | — | @@ -378,7 +378,7 @@ |
| 379 | 379 | $this->handleUnknownField( $item, $name, $value ); |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | | - $success = $item->writeToDB(); |
| | 382 | + $success = $item->save(); |
| 383 | 383 | |
| 384 | 384 | if ( $success ) { |
| 385 | 385 | return true; |
| Index: trunk/extensions/EducationProgram/specials/SpecialEnroll.php |
| — | — | @@ -241,7 +241,7 @@ |
| 242 | 242 | |
| 243 | 243 | $student->setFields( $fields ); |
| 244 | 244 | |
| 245 | | - $success = $student->writeToDB(); |
| | 245 | + $success = $student->save(); |
| 246 | 246 | |
| 247 | 247 | if ( $success ) { |
| 248 | 248 | $success = $student->associateWithCourses( array( $course ) ) && $success; |
| Index: trunk/extensions/EducationProgram/includes/EPDBObject.php |
| — | — | @@ -11,9 +11,9 @@ |
| 12 | 12 | * |
| 13 | 13 | * These methods are likely candidates for overriding: |
| 14 | 14 | * * getDefaults |
| 15 | | - * * removeFromDB |
| 16 | | - * * insertIntoDB |
| 17 | | - * * updateInDB |
| | 15 | + * * remove |
| | 16 | + * * insert |
| | 17 | + * * saveExisting |
| 18 | 18 | * * loadSummaryFields |
| 19 | 19 | * * getSummaryFields |
| 20 | 20 | * |
| — | — | @@ -24,9 +24,8 @@ |
| 25 | 25 | * Main instance methods: |
| 26 | 26 | * * getField(s) |
| 27 | 27 | * * setField(s) |
| 28 | | - * * writeToDB |
| 29 | | - * * removeFromDB |
| 30 | | - * * updateInDB |
| | 28 | + * * save |
| | 29 | + * * remove |
| 31 | 30 | * |
| 32 | 31 | * Main static methods: |
| 33 | 32 | * * select |
| — | — | @@ -418,11 +417,11 @@ |
| 419 | 418 | * |
| 420 | 419 | * @return boolean Success indicator |
| 421 | 420 | */ |
| 422 | | - public function writeToDB() { |
| | 421 | + public function save() { |
| 423 | 422 | if ( $this->hasIdField() ) { |
| 424 | | - return $this->updateInDB(); |
| | 423 | + return $this->saveExisting(); |
| 425 | 424 | } else { |
| 426 | | - return $this->insertIntoDB(); |
| | 425 | + return $this->insert(); |
| 427 | 426 | } |
| 428 | 427 | } |
| 429 | 428 | |
| — | — | @@ -433,7 +432,7 @@ |
| 434 | 433 | * |
| 435 | 434 | * @return boolean Success indicator |
| 436 | 435 | */ |
| 437 | | - protected function updateInDB() { |
| | 436 | + protected function saveExisting() { |
| 438 | 437 | $dbw = wfGetDB( DB_MASTER ); |
| 439 | 438 | |
| 440 | 439 | $success = $dbw->update( |
| — | — | @@ -453,7 +452,7 @@ |
| 454 | 453 | * |
| 455 | 454 | * @return boolean Success indicator |
| 456 | 455 | */ |
| 457 | | - protected function insertIntoDB() { |
| | 456 | + protected function insert() { |
| 458 | 457 | $dbw = wfGetDB( DB_MASTER ); |
| 459 | 458 | |
| 460 | 459 | $result = $dbw->insert( |
| — | — | @@ -477,7 +476,7 @@ |
| 478 | 477 | * |
| 479 | 478 | * @return boolean Success indicator |
| 480 | 479 | */ |
| 481 | | - public function removeFromDB() { |
| | 480 | + public function remove() { |
| 482 | 481 | $success = $this->delete( array( 'id' => $this->getId() ) ); |
| 483 | 482 | |
| 484 | 483 | if ( $success ) { |
| — | — | @@ -1190,7 +1189,7 @@ |
| 1191 | 1190 | foreach ( self::select( 'id', $conditions ) as /* EPDBObject */ $item ) { |
| 1192 | 1191 | $item->loadSummaryFields( $summaryFields ); |
| 1193 | 1192 | $item->setSummaryMode( true ); |
| 1194 | | - $item->updateInDB(); |
| | 1193 | + $item->saveExisting(); |
| 1195 | 1194 | } |
| 1196 | 1195 | |
| 1197 | 1196 | self::setReadDb( DB_SLAVE ); |
| — | — | @@ -1207,7 +1206,7 @@ |
| 1208 | 1207 | $this->updateSummaries = $update; |
| 1209 | 1208 | } |
| 1210 | 1209 | |
| 1211 | | - /** |
| | 1210 | + /** |
| 1212 | 1211 | * Sets the value for the @see $updateSummaries field. |
| 1213 | 1212 | * |
| 1214 | 1213 | * @since 0.1 |
| Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
| — | — | @@ -165,19 +165,19 @@ |
| 166 | 166 | |
| 167 | 167 | /** |
| 168 | 168 | * (non-PHPdoc) |
| 169 | | - * @see EPDBObject::removeFromDB() |
| | 169 | + * @see EPDBObject::remove() |
| 170 | 170 | */ |
| 171 | | - public function removeFromDB() { |
| | 171 | + public function remove() { |
| 172 | 172 | $id = $this->getId(); |
| 173 | 173 | $this->loadFields( array( 'name' ) ); |
| 174 | 174 | |
| 175 | | - $success = parent::removeFromDB(); |
| | 175 | + $success = parent::remove(); |
| 176 | 176 | |
| 177 | 177 | if ( $success ) { |
| 178 | 178 | $success = wfGetDB( DB_MASTER )->delete( 'ep_cas_per_org', array( 'cpo_org_id' => $id ) ) && $success; |
| 179 | 179 | |
| 180 | 180 | foreach ( EPCourse::select( 'id', array( 'org_id' => $id ) ) as /* EPCourse */ $course ) { |
| 181 | | - $success = $course->removeFromDB() && $success; |
| | 181 | + $success = $course->remove() && $success; |
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | |
| — | — | @@ -186,14 +186,14 @@ |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * (non-PHPdoc) |
| 190 | | - * @see EPDBObject::writeToDB() |
| | 190 | + * @see EPDBObject::save() |
| 191 | 191 | */ |
| 192 | | - public function writeToDB() { |
| | 192 | + public function save() { |
| 193 | 193 | if ( $this->hasField( 'name' ) ) { |
| 194 | 194 | $this->setField( 'name', $GLOBALS['wgLang']->ucfirst( $this->getField( 'name' ) ) ); |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | | - return parent::writeToDB(); |
| | 197 | + return parent::save(); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | /** |
| Index: trunk/extensions/EducationProgram/includes/EPRevisionedObject.php |
| — | — | @@ -85,7 +85,7 @@ |
| 86 | 86 | protected function storeRevision( EPRevisionedObject $revision, $isDelete = false ) { |
| 87 | 87 | if ( $this->storeRevisions ) { |
| 88 | 88 | $revison->setStoreRevisions( false ); |
| 89 | | - return $revison->writeToDB(); |
| | 89 | + return $revison->save(); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return true; |
| — | — | @@ -148,10 +148,10 @@ |
| 149 | 149 | |
| 150 | 150 | /** |
| 151 | 151 | * (non-PHPdoc) |
| 152 | | - * @see EPDBObject::updateInDB() |
| | 152 | + * @see EPDBObject::saveExisting() |
| 153 | 153 | */ |
| 154 | | - protected function updateInDB() { |
| 155 | | - $success = parent::updateInDB(); |
| | 154 | + protected function saveExisting() { |
| | 155 | + $success = parent::saveExisting(); |
| 156 | 156 | |
| 157 | 157 | if ( $success && !$this->inSummaryMode ) { |
| 158 | 158 | $revision = $this->getCurrentRevision(); |
| — | — | @@ -167,10 +167,10 @@ |
| 168 | 168 | |
| 169 | 169 | /** |
| 170 | 170 | * (non-PHPdoc) |
| 171 | | - * @see EPDBObject::insertIntoDB() |
| | 171 | + * @see EPDBObject::insert() |
| 172 | 172 | */ |
| 173 | | - protected function insertIntoDB() { |
| 174 | | - $result = parent::insertIntoDB(); |
| | 173 | + protected function insert() { |
| | 174 | + $result = parent::insert(); |
| 175 | 175 | |
| 176 | 176 | if ( $result ) { |
| 177 | 177 | $this->storeRevision( $this ); |
| — | — | @@ -182,10 +182,10 @@ |
| 183 | 183 | |
| 184 | 184 | /** |
| 185 | 185 | * (non-PHPdoc) |
| 186 | | - * @see EPDBObject::removeFromDB() |
| | 186 | + * @see EPDBObject::remove() |
| 187 | 187 | */ |
| 188 | | - public function removeFromDB() { |
| 189 | | - $success = parent::removeFromDB(); |
| | 188 | + public function remove() { |
| | 189 | + $success = parent::remove(); |
| 190 | 190 | |
| 191 | 191 | if ( $success ) { |
| 192 | 192 | $this->log( 'remove' ); |
| Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
| — | — | @@ -239,10 +239,10 @@ |
| 240 | 240 | |
| 241 | 241 | /** |
| 242 | 242 | * (non-PHPdoc) |
| 243 | | - * @see EPDBObject::insertIntoDB() |
| | 243 | + * @see EPDBObject::insert() |
| 244 | 244 | */ |
| 245 | | - protected function insertIntoDB() { |
| 246 | | - $success = parent::insertIntoDB(); |
| | 245 | + protected function insert() { |
| | 246 | + $success = parent::insert(); |
| 247 | 247 | |
| 248 | 248 | if ( $success && $this->updateSummaries ) { |
| 249 | 249 | EPOrg::updateSummaryFields( array( 'courses', 'active' ), array( 'id' => $this->getField( 'org_id' ) ) ); |
| — | — | @@ -253,9 +253,9 @@ |
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * (non-PHPdoc) |
| 257 | | - * @see EPDBObject::removeFromDB() |
| | 257 | + * @see EPDBObject::remove() |
| 258 | 258 | */ |
| 259 | | - public function removeFromDB() { |
| | 259 | + public function remove() { |
| 260 | 260 | $id = $this->getId(); |
| 261 | 261 | |
| 262 | 262 | if ( $this->updateSummaries ) { |
| — | — | @@ -263,7 +263,7 @@ |
| 264 | 264 | $orgId = $this->getField( 'org_id' ); |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | | - $success = parent::removeFromDB(); |
| | 267 | + $success = parent::remove(); |
| 268 | 268 | |
| 269 | 269 | if ( $success && $this->updateSummaries ) { |
| 270 | 270 | EPOrg::updateSummaryFields( array( 'courses', 'students', 'active', 'instructors', 'oas', 'cas' ), array( 'id' => $orgId ) ); |
| — | — | @@ -280,9 +280,9 @@ |
| 281 | 281 | |
| 282 | 282 | /** |
| 283 | 283 | * (non-PHPdoc) |
| 284 | | - * @see EPDBObject::updateInDB() |
| | 284 | + * @see EPDBObject::saveExisting() |
| 285 | 285 | */ |
| 286 | | - protected function updateInDB() { |
| | 286 | + protected function saveExisting() { |
| 287 | 287 | if ( $this->updateSummaries ) { |
| 288 | 288 | $currentFields = array(); |
| 289 | 289 | |
| — | — | @@ -297,7 +297,7 @@ |
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | | - $success = parent::updateInDB(); |
| | 301 | + $success = parent::saveExisting(); |
| 302 | 302 | |
| 303 | 303 | if ( $this->updateSummaries && $success ) { |
| 304 | 304 | if ( array_key_exists( 'org_id', $currentFields ) && $currentFields['org_id'] !== $this->getField( 'org_id' ) ) { |
| — | — | @@ -319,14 +319,14 @@ |
| 320 | 320 | |
| 321 | 321 | /** |
| 322 | 322 | * (non-PHPdoc) |
| 323 | | - * @see EPDBObject::writeToDB() |
| | 323 | + * @see EPDBObject::save() |
| 324 | 324 | */ |
| 325 | | - public function writeToDB() { |
| | 325 | + public function save() { |
| 326 | 326 | if ( $this->hasField( 'name' ) ) { |
| 327 | 327 | $this->setField( 'name', $GLOBALS['wgLang']->ucfirst( $this->getField( 'name' ) ) ); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | | - return parent::writeToDB(); |
| | 330 | + return parent::save(); |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | /** |
| — | — | @@ -646,7 +646,7 @@ |
| 647 | 647 | |
| 648 | 648 | if ( $save ) { |
| 649 | 649 | $this->disableLogging(); |
| 650 | | - $success = $this->writeToDB(); |
| | 650 | + $success = $this->save(); |
| 651 | 651 | $this->enableLogging(); |
| 652 | 652 | } |
| 653 | 653 | |
| — | — | @@ -699,7 +699,7 @@ |
| 700 | 700 | |
| 701 | 701 | if ( $save ) { |
| 702 | 702 | $this->disableLogging(); |
| 703 | | - $success = $this->writeToDB(); |
| | 703 | + $success = $this->save(); |
| 704 | 704 | $this->enableLogging(); |
| 705 | 705 | } |
| 706 | 706 | |
| Index: trunk/extensions/EducationProgram/api/ApiDeleteEducation.php |
| — | — | @@ -55,11 +55,11 @@ |
| 56 | 56 | $everythingOk = true; |
| 57 | 57 | |
| 58 | 58 | foreach ( $params['ids'] as $id ) { |
| 59 | | - // $instance->removeFromDB is used instead of Class::delete, |
| | 59 | + // $instance->remove is used instead of Class::delete, |
| 60 | 60 | // so that linked data also gets deleted. |
| 61 | 61 | $c = self::$typeMap[$params['type']]; |
| 62 | 62 | $object = new $c( array( 'id' => $id ) ); |
| 63 | | - $everythingOk = $object->removeFromDB() && $everythingOk; |
| | 63 | + $everythingOk = $object->remove() && $everythingOk; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $this->getResult()->addValue( |