From 6fb0b31d2f0ad35ad18d4675bcd3c6bef7552316 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 13 Jun 2015 12:49:33 -0700 Subject: [PATCH] Moved patrol code in commitRollback() down to reduce contention * It still happens if the edit fails as before * Also, women...they exist... Change-Id: If8cc4c55d4edcfb083b7018b2645167c8220ec81 --- includes/page/WikiPage.php | 49 +++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 5e72151e5b..cb3def3ed6 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3024,7 +3024,7 @@ class WikiPage implements Page, IDBAccessObject { ) ); } - // Get the last edit not by this guy... + // Get the last edit not by this person... // Note: these may not be public values $user = intval( $current->getUser( Revision::RAW ) ); $user_text = $dbw->addQuotes( $current->getUserText( Revision::RAW ) ); @@ -3046,29 +3046,6 @@ class WikiPage implements Page, IDBAccessObject { return array( array( 'notvisiblerev' ) ); } - // Set patrolling and bot flag on the edits, which gets rollbacked. - // This is done before the rollback edit to have patrolling also on failure (bug 62157). - $set = array(); - if ( $bot && $guser->isAllowed( 'markbotedits' ) ) { - // Mark all reverted edits as bot - $set['rc_bot'] = 1; - } - - if ( $wgUseRCPatrol ) { - // Mark all reverted edits as patrolled - $set['rc_patrolled'] = 1; - } - - if ( count( $set ) ) { - $dbw->update( 'recentchanges', $set, - array( /* WHERE */ - 'rc_cur_id' => $current->getPage(), - 'rc_user_text' => $current->getUserText(), - 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ), - ), __METHOD__ - ); - } - // Generate the edit summary if necessary $target = Revision::newFromId( $s->rev_id, Revision::READ_LATEST ); if ( empty( $summary ) ) { @@ -3117,6 +3094,30 @@ class WikiPage implements Page, IDBAccessObject { $guser ); + // Set patrolling and bot flag on the edits, which gets rollbacked. + // This is done even on edit failure to have patrolling in that case (bug 62157). + $set = array(); + if ( $bot && $guser->isAllowed( 'markbotedits' ) ) { + // Mark all reverted edits as bot + $set['rc_bot'] = 1; + } + + if ( $wgUseRCPatrol ) { + // Mark all reverted edits as patrolled + $set['rc_patrolled'] = 1; + } + + if ( count( $set ) ) { + $dbw->update( 'recentchanges', $set, + array( /* WHERE */ + 'rc_cur_id' => $current->getPage(), + 'rc_user_text' => $current->getUserText(), + 'rc_timestamp > ' . $dbw->addQuotes( $s->rev_timestamp ), + ), + __METHOD__ + ); + } + if ( !$status->isOK() ) { return $status->getErrorsArray(); } -- 2.20.1