r78863 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78862‎ | r78863 | r78864 >
Date:23:55, 22 December 2010
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Refactor out a bit of the code duplication
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeRevision.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeRevision.php
@@ -670,7 +670,6 @@
671671 * @param $revs array of revision IDs
672672 */
673673 public function addReferencesFrom( $revs ) {
674 - $dbw = wfGetDB( DB_MASTER );
675674 $data = array();
676675 foreach ( array_unique( (array)$revs ) as $rev ) {
677676 if ( $rev > $this->getId() ) {
@@ -681,8 +680,13 @@
682681 );
683682 }
684683 }
685 - $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
 684+ $this->addReferences( $data );
686685 }
 686+
 687+ private function addReferences( $data ) {
 688+ $dbw = wfGetDB( DB_MASTER );
 689+ $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
 690+ }
687691
688692 /**
689693 * Same as addReferencesFrom(), but adds references from this revision to
@@ -690,7 +694,6 @@
691695 * @param $revs array of revision IDs
692696 */
693697 public function addReferencesTo( $revs ) {
694 - $dbw = wfGetDB( DB_MASTER );
695698 $data = array();
696699 foreach ( array_unique( (array)$revs ) as $rev ) {
697700 if ( $rev < $this->getId() ) {
@@ -701,7 +704,7 @@
702705 );
703706 }
704707 }
705 - $dbw->insert( 'code_relations', $data, __METHOD__, array( 'IGNORE' ) );
 708+ $this->addReferences( $data );
706709 }
707710
708711 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r78880Fix tab fail from r78863...reedy10:53, 23 December 2010

Comments

#Comment by Nikerabbit (talk | contribs)   07:21, 23 December 2010

Indentation fail in addReferences.

Status & tagging log