r36681 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36680‎ | r36681 | r36682 >
Date:18:48, 26 June 2008
Author:aaron
Status:old
Tags:
Comment:
* Patrol mark consistency (bug 14637)
* Remove useless config var
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.class.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -24,7 +24,7 @@
2525 $wgExtensionCredits['specialpage'][] = array(
2626 'name' => 'Flagged Revisions',
2727 'author' => array( 'Aaron Schulz', 'Joerg Baach' ),
28 - 'version' => '1.08',
 28+ 'version' => '1.09',
2929 'url' => 'http://www.mediawiki.org/wiki/Extension:FlaggedRevs',
3030 'descriptionmsg' => 'flaggedrevs-desc',
3131 );
@@ -111,10 +111,6 @@
112112 'style' => array( 'review' => 3 ),
113113 );
114114
115 -# Mark all previous edits as "patrolled" when an edit is reviewed.
116 -# This just sets markers on recent changes.
117 -$wgFlaggedRevsCascade = true;
118 -
119115 # Please set these as something different. Any text will do, though it probably
120116 # shouldn't be very short (less secure) or very long (waste of resources).
121117 # There must be four codes, and only the first four are checked.
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php
@@ -979,13 +979,7 @@
980980 }
981981 # Mark as patrolled
982982 if( $patrol ) {
983 - $dbw->update( 'recentchanges',
984 - array( 'rc_patrolled' => 1 ),
985 - array( 'rc_this_oldid' => $rev->getId(),
986 - 'rc_user_text' => $rev->getRawUserText(),
987 - 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
988 - __METHOD__,
989 - array( 'LIMIT' => 1 ) );
 983+ RevisionReview::updateRecentChanges( $title, $rev->getId() );
990984 }
991985 # Done!
992986 $dbw->commit();
@@ -1654,7 +1648,7 @@
16551649 $patrol = true; // mark by default
16561650 }
16571651 if( $patrol ) {
1658 - RecentChange::markPatrolled( $rc->mAttribs['rc_id'] );
 1652+ RevisionReview::updateRecentChanges( $rc->getTitle(), $rc->mAttribs['rc_this_oldid'] );
16591653 if( $record ) {
16601654 PatrolLog::record( $rc->mAttribs['rc_id'], true );
16611655 }
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -618,7 +618,7 @@
619619 }
620620
621621 # Update recent changes
622 - $this->updateRecentChanges( $this->page, $dbw, $rev, $this->rcid );
 622+ self::updateRecentChanges( $this->page, $rev->getId(), $this->rcid );
623623
624624 # Update the article review log
625625 $this->updateLog( $this->page, $this->dims, $this->oflags, $this->comment, $this->oldid, $oldSvId, true );
@@ -719,36 +719,27 @@
720720 return true;
721721 }
722722
723 - private function updateRecentChanges( $title, $dbw, $rev, $rcid ) {
 723+ public static function updateRecentChanges( $title, $revId, $rcId = false ) {
724724 wfProfileIn( __METHOD__ );
725 - # Should olders edits be marked as patrolled now?
726 - global $wgFlaggedRevsCascade;
727 - if( $wgFlaggedRevsCascade ) {
 725+ $dbw = wfGetDB( DB_MASTER );
 726+ # Olders edits be marked as patrolled now...
 727+ $dbw->update( 'recentchanges',
 728+ array( 'rc_patrolled' => 1 ),
 729+ array( 'rc_namespace' => $title->getNamespace(),
 730+ 'rc_title' => $title->getDBKey(),
 731+ 'rc_this_oldid <= ' . intval($revId) ),
 732+ __METHOD__,
 733+ array( 'USE INDEX' => 'rc_namespace_title', 'LIMIT' => 50 )
 734+ );
 735+ # New page patrol may be enabled. If so, the rc_id may be the first
 736+ # edit and not this one. If it is different, mark it too.
 737+ if( $rcId && $rcId != $revId ) {
728738 $dbw->update( 'recentchanges',
729739 array( 'rc_patrolled' => 1 ),
730 - array( 'rc_namespace' => $title->getNamespace(),
731 - 'rc_title' => $title->getDBKey(),
732 - 'rc_this_oldid <= ' . $rev->getId() ),
733 - __METHOD__,
734 - array( 'USE INDEX' => 'rc_namespace_title', 'LIMIT' => 50 ) );
735 - } else {
736 - # Mark this edit as patrolled...
737 - $dbw->update( 'recentchanges',
738 - array( 'rc_patrolled' => 1 ),
739 - array( 'rc_this_oldid' => $rev->getId(),
740 - 'rc_user_text' => $rev->getRawUserText(),
741 - 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
742 - __METHOD__,
743 - array( 'USE INDEX' => 'rc_user_text', 'LIMIT' => 1 ) );
744 - # New page patrol may be enabled. If so, the rc_id may be the first
745 - # edit and not this one. If it is different, mark it too.
746 - if( $rcid && $rcid != $rev->getId() ) {
747 - $dbw->update( 'recentchanges',
748 - array( 'rc_patrolled' => 1 ),
749 - array( 'rc_id' => $rcid,
750 - 'rc_type' => RC_NEW ),
751 - __METHOD__ );
752 - }
 740+ array( 'rc_id' => $rcid,
 741+ 'rc_type' => RC_NEW ),
 742+ __METHOD__
 743+ );
753744 }
754745 wfProfileOut( __METHOD__ );
755746 }

Status & tagging log