r109939 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109938‎ | r109939 | r109940 >
Date:18:58, 24 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r109872; fixed recursion issue and registration of special pages
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -409,8 +409,6 @@
410410 * @return boolean Success indicator
411411 */
412412 protected function updateInDB() {
413 - $this->storeRevision();
414 -
415413 $dbw = wfGetDB( DB_MASTER );
416414
417415 $success = $dbw->update(
@@ -421,20 +419,36 @@
422420 );
423421
424422 if ( $success ) {
 423+ $this->storeRevision();
425424 $this->log( 'update' );
426425 }
427426
428427 return $success;
429428 }
430429
 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+ */
431440 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 );
435445
436 - $revison = EPRevision::newFromObject( $revison, $isDelete );
 446+ $revison = EPRevision::newFromObject( $revison, $isDelete );
 447+ $revison->setStoreRevisions( false );
437448
438 - $revison->writeToDB();
 449+ return $revison->writeToDB();
 450+ }
 451+
 452+ return true;
439453 }
440454
441455 /**
@@ -456,6 +470,7 @@
457471
458472 if ( $result ) {
459473 $this->setField( 'id', $dbw->insertId() );
 474+ $this->storeRevision();
460475 $this->log( 'add' );
461476 }
462477
@@ -470,8 +485,6 @@
471486 * @return boolean Success indicator
472487 */
473488 public function removeFromDB() {
474 - $this->storeRevision( true );
475 -
476489 $success = $this->delete( array( 'id' => $this->getId() ) );
477490
478491 if ( $success ) {
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -106,6 +106,8 @@
107107 $wgAutoloadClasses['SpecialOA'] = dirname( __FILE__ ) . '/specials/SpecialOA.php';
108108 $wgAutoloadClasses['SpecialEPHistory'] = dirname( __FILE__ ) . '/specials/SpecialEPHistory.php';
109109 $wgAutoloadClasses['SpecialCourseHistory'] = dirname( __FILE__ ) . '/specials/SpecialCourseHistory.php';
 110+$wgAutoloadClasses['SpecialMasterCourseHistory'] = dirname( __FILE__ ) . '/specials/SpecialMasterCourseHistory.php';
 111+$wgAutoloadClasses['SpecialInstitutionHistory'] = dirname( __FILE__ ) . '/specials/SpecialInstitutionHistory.php';
110112
111113 // Special pages
112114 $wgSpecialPages['MyCourses'] = 'SpecialMyCourses';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109872some initial work on revision supportjeroendedauw23:35, 23 January 2012

Status & tagging log