Index: trunk/extensions/EducationProgram/includes/EPDBObject.php |
— | — | @@ -409,8 +409,6 @@ |
410 | 410 | * @return boolean Success indicator |
411 | 411 | */ |
412 | 412 | protected function updateInDB() { |
413 | | - $this->storeRevision(); |
414 | | - |
415 | 413 | $dbw = wfGetDB( DB_MASTER ); |
416 | 414 | |
417 | 415 | $success = $dbw->update( |
— | — | @@ -421,20 +419,36 @@ |
422 | 420 | ); |
423 | 421 | |
424 | 422 | if ( $success ) { |
| 423 | + $this->storeRevision(); |
425 | 424 | $this->log( 'update' ); |
426 | 425 | } |
427 | 426 | |
428 | 427 | return $success; |
429 | 428 | } |
430 | 429 | |
| 430 | + /** |
| 431 | + * Store the current version of the object in the revisions table. |
| 432 | + * TODO: add handling for comment, minor edit, ect stuff |
| 433 | + * |
| 434 | + * @since 0.1 |
| 435 | + * |
| 436 | + * @param bool $isDelete |
| 437 | + * |
| 438 | + * @return boolean Success indicator |
| 439 | + */ |
431 | 440 | protected function storeRevision( $isDelete = false ) { |
432 | | - static::setReadDb( DB_MASTER ); |
433 | | - $revison = static::selectRow( null, array( 'id' => $this->getId() ) ); |
434 | | - static::setReadDb( DB_SLAVE ); |
| 441 | + if ( $this->storeRevisions ) { |
| 442 | + static::setReadDb( DB_MASTER ); |
| 443 | + $revison = static::selectRow( null, array( 'id' => $this->getId() ) ); |
| 444 | + static::setReadDb( DB_SLAVE ); |
435 | 445 | |
436 | | - $revison = EPRevision::newFromObject( $revison, $isDelete ); |
| 446 | + $revison = EPRevision::newFromObject( $revison, $isDelete ); |
| 447 | + $revison->setStoreRevisions( false ); |
437 | 448 | |
438 | | - $revison->writeToDB(); |
| 449 | + return $revison->writeToDB(); |
| 450 | + } |
| 451 | + |
| 452 | + return true; |
439 | 453 | } |
440 | 454 | |
441 | 455 | /** |
— | — | @@ -456,6 +470,7 @@ |
457 | 471 | |
458 | 472 | if ( $result ) { |
459 | 473 | $this->setField( 'id', $dbw->insertId() ); |
| 474 | + $this->storeRevision(); |
460 | 475 | $this->log( 'add' ); |
461 | 476 | } |
462 | 477 | |
— | — | @@ -470,8 +485,6 @@ |
471 | 486 | * @return boolean Success indicator |
472 | 487 | */ |
473 | 488 | public function removeFromDB() { |
474 | | - $this->storeRevision( true ); |
475 | | - |
476 | 489 | $success = $this->delete( array( 'id' => $this->getId() ) ); |
477 | 490 | |
478 | 491 | if ( $success ) { |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -106,6 +106,8 @@ |
107 | 107 | $wgAutoloadClasses['SpecialOA'] = dirname( __FILE__ ) . '/specials/SpecialOA.php'; |
108 | 108 | $wgAutoloadClasses['SpecialEPHistory'] = dirname( __FILE__ ) . '/specials/SpecialEPHistory.php'; |
109 | 109 | $wgAutoloadClasses['SpecialCourseHistory'] = dirname( __FILE__ ) . '/specials/SpecialCourseHistory.php'; |
| 110 | +$wgAutoloadClasses['SpecialMasterCourseHistory'] = dirname( __FILE__ ) . '/specials/SpecialMasterCourseHistory.php'; |
| 111 | +$wgAutoloadClasses['SpecialInstitutionHistory'] = dirname( __FILE__ ) . '/specials/SpecialInstitutionHistory.php'; |
110 | 112 | |
111 | 113 | // Special pages |
112 | 114 | $wgSpecialPages['MyCourses'] = 'SpecialMyCourses'; |