r34836 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34835‎ | r34836 | r34837 >
Date:23:00, 14 May 2008
Author:aaron
Status:old
Tags:
Comment:
* wfMsgForContent() for log comment
* Don't waste the effort on premature query
* Let sysops bypass move restrictions
* Use GAID_FOR_UPDATE for baseRevId stuff
* let $latestID be the rev ID if now title yet (new page)
* Casing tweaks
* Autoreview on normal submit only
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -142,6 +142,8 @@
143143
144144 # Stable version selection and default page revision selection can be set per page.
145145 $wgGroupPermissions['sysop']['stablesettings'] = true;
 146+# Sysops can always move stable pages
 147+$wgGroupPermissions['sysop']['movestable'] = true;
146148
147149 # Try to avoid flood by having autoconfirmed user edits to non-reviewable
148150 # namespaces autopatrolled.
@@ -190,7 +192,7 @@
191193 #########
192194
193195 # Bump this number every time you change flaggedrevs.css/flaggedrevs.js
194 -$wgFlaggedRevStyleVersion = 18;
 196+$wgFlaggedRevStyleVersion = 19;
195197
196198 $wgExtensionFunctions[] = 'efLoadFlaggedRevs';
197199
@@ -1191,7 +1193,7 @@
11921194 * LinksUpdate was already called via edit operations, so the page
11931195 * fields will be up to date. This updates the stable version.
11941196 */
1195 - public static function autoReviewEdit( $article, $user, $text, $rev, $flags ) {
 1197+ public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $patrol = true ) {
11961198 global $wgParser, $wgFlaggedRevsAutoReview;
11971199
11981200 wfProfileIn( __METHOD__ );
@@ -1204,6 +1206,7 @@
12051207 $poutput = false;
12061208 # Use master to avoid lag issues.
12071209 $latestID = $article->getTitle()->getLatestRevID(GAID_FOR_UPDATE);
 1210+ $latestID = $latestID ? $latestID : $rev->getId(); // new pages, page row not added yet
12081211 # Parse the revision HTML output
12091212 $options = self::makeParserOptions( $user );
12101213 $title = $article->getTitle(); // avoid pass-by-ref error
@@ -1295,18 +1298,20 @@
12961299 array( array('fr_page_id','fr_rev_id') ), $revisionset,
12971300 __METHOD__ );
12981301 # Mark as patrolled
1299 - $dbw->update( 'recentchanges',
1300 - array( 'rc_patrolled' => 1 ),
1301 - array( 'rc_this_oldid' => $rev->getId(),
1302 - 'rc_user_text' => $rev->getRawUserText(),
1303 - 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
1304 - __METHOD__,
1305 - array( 'LIMIT' => 1 ) );
 1302+ if( $patrol ) {
 1303+ $dbw->update( 'recentchanges',
 1304+ array( 'rc_patrolled' => 1 ),
 1305+ array( 'rc_this_oldid' => $rev->getId(),
 1306+ 'rc_user_text' => $rev->getRawUserText(),
 1307+ 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
 1308+ __METHOD__,
 1309+ array( 'LIMIT' => 1 ) );
 1310+ }
13061311 # Done!
13071312 $dbw->commit();
13081313
13091314 # Update the article review log
1310 - RevisionReview::updateLog( $article->getTitle(), $flags, array(), wfMsg('revreview-auto'), $rev->getID(), true );
 1315+ RevisionReview::updateLog( $article->getTitle(), $flags, array(), wfMsgForContent('revreview-auto'), $rev->getID(), true );
13111316
13121317 # If we know that this is now the new stable version
13131318 # (which it probably is), save it to the cache...
@@ -1821,7 +1826,7 @@
18221827 return true;
18231828 # Allow for only editors/reviewers to move this
18241829 $right = $frev->getQuality() ? 'validate' : 'review';
1825 - if( !$user->isAllowed( $right ) ) {
 1830+ if( !$user->isAllowed($right) && !$user->isAllowed('movestable') ) {
18261831 $result = false;
18271832 return false;
18281833 }
@@ -1867,7 +1872,10 @@
18681873 * version, try to automatically review it.
18691874 */
18701875 public static function maybeMakeEditReviewed( $rev ) {
1871 - global $wgFlaggedRevsAutoReview, $wgFlaggedRevsAutoReviewNew, $wgFlaggedArticle, $wgRequest;
 1876+ global $wgFlaggedRevsAutoReview, $wgFlaggedArticle, $wgRequest;
 1877+ # For edits from form submits only
 1878+ if( !$wgRequest->getVal('wpSave') || !$wgRequest->wasPosted() )
 1879+ return true;
18721880 # Get the user
18731881 $user = User::newFromId( $rev->getUser() );
18741882 if( !$wgFlaggedRevsAutoReview || !$user->isAllowed('autoreview') )
@@ -1896,6 +1904,7 @@
18971905 $frev = self::getFlaggedRev( $title, $prevRev->getId() );
18981906 # Check for new pages
18991907 } else if( !$prevRev ) {
 1908+ global $wgFlaggedRevsAutoReviewNew;
19001909 $reviewableNewPage = $wgFlaggedRevsAutoReviewNew;
19011910 }
19021911 }
@@ -1906,7 +1915,8 @@
19071916 foreach( self::$dimensions as $tag => $minQL ) {
19081917 $flags[$tag] = 1;
19091918 }
1910 - self::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags );
 1919+ # Review this revision of the page. Let articlesavecomplete hook do rc_patrolled bit...
 1920+ self::autoReviewEdit( $article, $user, $rev->getText(), $rev, $flags, false );
19111921 }
19121922 }
19131923 if( $wgFlaggedArticle ) {
@@ -1958,7 +1968,7 @@
19591969 $patrol = false;
19601970 // Is the page reviewable?
19611971 if( self::isPageReviewable($title) ) {
1962 - $patrol = self::revIsFlagged($title, $rev->getId(), GAID_FOR_UPDATE );
 1972+ $patrol = self::revIsFlagged( $title, $rev->getId(), GAID_FOR_UPDATE );
19631973 // Can this be patrolled?
19641974 } else if( self::isPagePatrollable($title) ) {
19651975 $patrol = $user->isAllowed('autopatrolother');
@@ -1969,7 +1979,7 @@
19701980 $dbw = wfGetDB( DB_MASTER );
19711981 $dbw->update( 'recentchanges',
19721982 array( 'rc_patrolled' => 1 ),
1973 - array( 'rc_this_oldid' => $rev->getID(),
 1983+ array( 'rc_this_oldid' => $rev->getId(),
19741984 'rc_user_text' => $rev->getRawUserText(),
19751985 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ),
19761986 __METHOD__,
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -883,7 +883,7 @@
884884 if( $editform->mArticle->mRevision ) {
885885 $revid = $editform->mArticle->mRevision->mId;
886886 } else {
887 - $revid = $editform->mArticle->getLatest();
 887+ $revid = $editform->mArticle->getTitle()->getLatestRevID(GAID_FOR_UPDATE);
888888 }
889889 # If undoing a few consecutive top edits, we know the base ID
890890 if( $undo = $wgRequest->getIntOrNull('undo') ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r34840Add description for new right 'movestable' (r34836)raymond23:27, 14 May 2008

Status & tagging log