r31241 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31240‎ | r31241 | r31242 >
Date:05:58, 25 February 2008
Author:aaron
Status:old
Tags:
Comment:
Don't allow double logging of patrol events
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)
  • /trunk/phase3/includes/RecentChange.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/RecentChange.php
@@ -238,6 +238,7 @@
239239 * Mark a given change as patrolled
240240 *
241241 * @param mixed $change RecentChange or corresponding rc_id
 242+ * @returns integer number of affected rows
242243 */
243244 public static function markPatrolled( $change ) {
244245 $rcid = $change instanceof RecentChange
@@ -254,6 +255,7 @@
255256 ),
256257 __METHOD__
257258 );
 259+ return $dbw->affectedRows();
258260 }
259261
260262 # Makes an entry in the database corresponding to an edit
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -149,8 +149,10 @@
150150 function markPatrolled() {
151151 global $wgOut;
152152
153 - RecentChange::markPatrolled( $this->rcid );
154 - PatrolLog::record( $this->rcid );
 153+ $changed = RecentChange::markPatrolled( $this->rcid );
 154+ if( $changed ) {
 155+ PatrolLog::record( $this->rcid );
 156+ }
155157 # Inform the user
156158 $wgOut->setPageTitle( wfMsg( 'markedaspatrolled' ) );
157159 $wgOut->addWikiText( wfMsgNoTrans( 'revreview-patrolled', $this->page->getPrefixedText() ) );

Status & tagging log