Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -142,6 +142,8 @@ |
143 | 143 | |
144 | 144 | # Stable version selection and default page revision selection can be set per page. |
145 | 145 | $wgGroupPermissions['sysop']['stablesettings'] = true; |
| 146 | +# Sysops can always move stable pages |
| 147 | +$wgGroupPermissions['sysop']['movestable'] = true; |
146 | 148 | |
147 | 149 | # Try to avoid flood by having autoconfirmed user edits to non-reviewable |
148 | 150 | # namespaces autopatrolled. |
— | — | @@ -190,7 +192,7 @@ |
191 | 193 | ######### |
192 | 194 | |
193 | 195 | # Bump this number every time you change flaggedrevs.css/flaggedrevs.js |
194 | | -$wgFlaggedRevStyleVersion = 18; |
| 196 | +$wgFlaggedRevStyleVersion = 19; |
195 | 197 | |
196 | 198 | $wgExtensionFunctions[] = 'efLoadFlaggedRevs'; |
197 | 199 | |
— | — | @@ -1191,7 +1193,7 @@ |
1192 | 1194 | * LinksUpdate was already called via edit operations, so the page |
1193 | 1195 | * fields will be up to date. This updates the stable version. |
1194 | 1196 | */ |
1195 | | - public static function autoReviewEdit( $article, $user, $text, $rev, $flags ) { |
| 1197 | + public static function autoReviewEdit( $article, $user, $text, $rev, $flags, $patrol = true ) { |
1196 | 1198 | global $wgParser, $wgFlaggedRevsAutoReview; |
1197 | 1199 | |
1198 | 1200 | wfProfileIn( __METHOD__ ); |
— | — | @@ -1204,6 +1206,7 @@ |
1205 | 1207 | $poutput = false; |
1206 | 1208 | # Use master to avoid lag issues. |
1207 | 1209 | $latestID = $article->getTitle()->getLatestRevID(GAID_FOR_UPDATE); |
| 1210 | + $latestID = $latestID ? $latestID : $rev->getId(); // new pages, page row not added yet |
1208 | 1211 | # Parse the revision HTML output |
1209 | 1212 | $options = self::makeParserOptions( $user ); |
1210 | 1213 | $title = $article->getTitle(); // avoid pass-by-ref error |
— | — | @@ -1295,18 +1298,20 @@ |
1296 | 1299 | array( array('fr_page_id','fr_rev_id') ), $revisionset, |
1297 | 1300 | __METHOD__ ); |
1298 | 1301 | # 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 | + } |
1306 | 1311 | # Done! |
1307 | 1312 | $dbw->commit(); |
1308 | 1313 | |
1309 | 1314 | # 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 ); |
1311 | 1316 | |
1312 | 1317 | # If we know that this is now the new stable version |
1313 | 1318 | # (which it probably is), save it to the cache... |
— | — | @@ -1821,7 +1826,7 @@ |
1822 | 1827 | return true; |
1823 | 1828 | # Allow for only editors/reviewers to move this |
1824 | 1829 | $right = $frev->getQuality() ? 'validate' : 'review'; |
1825 | | - if( !$user->isAllowed( $right ) ) { |
| 1830 | + if( !$user->isAllowed($right) && !$user->isAllowed('movestable') ) { |
1826 | 1831 | $result = false; |
1827 | 1832 | return false; |
1828 | 1833 | } |
— | — | @@ -1867,7 +1872,10 @@ |
1868 | 1873 | * version, try to automatically review it. |
1869 | 1874 | */ |
1870 | 1875 | 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; |
1872 | 1880 | # Get the user |
1873 | 1881 | $user = User::newFromId( $rev->getUser() ); |
1874 | 1882 | if( !$wgFlaggedRevsAutoReview || !$user->isAllowed('autoreview') ) |
— | — | @@ -1896,6 +1904,7 @@ |
1897 | 1905 | $frev = self::getFlaggedRev( $title, $prevRev->getId() ); |
1898 | 1906 | # Check for new pages |
1899 | 1907 | } else if( !$prevRev ) { |
| 1908 | + global $wgFlaggedRevsAutoReviewNew; |
1900 | 1909 | $reviewableNewPage = $wgFlaggedRevsAutoReviewNew; |
1901 | 1910 | } |
1902 | 1911 | } |
— | — | @@ -1906,7 +1915,8 @@ |
1907 | 1916 | foreach( self::$dimensions as $tag => $minQL ) { |
1908 | 1917 | $flags[$tag] = 1; |
1909 | 1918 | } |
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 ); |
1911 | 1921 | } |
1912 | 1922 | } |
1913 | 1923 | if( $wgFlaggedArticle ) { |
— | — | @@ -1958,7 +1968,7 @@ |
1959 | 1969 | $patrol = false; |
1960 | 1970 | // Is the page reviewable? |
1961 | 1971 | if( self::isPageReviewable($title) ) { |
1962 | | - $patrol = self::revIsFlagged($title, $rev->getId(), GAID_FOR_UPDATE ); |
| 1972 | + $patrol = self::revIsFlagged( $title, $rev->getId(), GAID_FOR_UPDATE ); |
1963 | 1973 | // Can this be patrolled? |
1964 | 1974 | } else if( self::isPagePatrollable($title) ) { |
1965 | 1975 | $patrol = $user->isAllowed('autopatrolother'); |
— | — | @@ -1969,7 +1979,7 @@ |
1970 | 1980 | $dbw = wfGetDB( DB_MASTER ); |
1971 | 1981 | $dbw->update( 'recentchanges', |
1972 | 1982 | array( 'rc_patrolled' => 1 ), |
1973 | | - array( 'rc_this_oldid' => $rev->getID(), |
| 1983 | + array( 'rc_this_oldid' => $rev->getId(), |
1974 | 1984 | 'rc_user_text' => $rev->getRawUserText(), |
1975 | 1985 | 'rc_timestamp' => $dbw->timestamp( $rev->getTimestamp() ) ), |
1976 | 1986 | __METHOD__, |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -883,7 +883,7 @@ |
884 | 884 | if( $editform->mArticle->mRevision ) { |
885 | 885 | $revid = $editform->mArticle->mRevision->mId; |
886 | 886 | } else { |
887 | | - $revid = $editform->mArticle->getLatest(); |
| 887 | + $revid = $editform->mArticle->getTitle()->getLatestRevID(GAID_FOR_UPDATE); |
888 | 888 | } |
889 | 889 | # If undoing a few consecutive top edits, we know the base ID |
890 | 890 | if( $undo = $wgRequest->getIntOrNull('undo') ) { |