Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -118,12 +118,14 @@ |
119 | 119 | $wgHooks['ParserAfterTidy'][] = array( $wgFlaggedRevs, 'parserInjectImageTimestamps' ); |
120 | 120 | $wgHooks['OutputPageParserOutput'][] = array( $wgFlaggedRevs, 'outputInjectImageTimestamps'); |
121 | 121 | # Page review on edit |
122 | | - $wgHooks['ArticleUpdateBeforeRedirect'][] = array($wgFlaggedArticle, 'injectReviewDiffURLParams'); |
| 122 | + $wgHooks['ArticleUpdateBeforeRedirect'][] = array($wgFlaggedRevs, 'injectReviewDiffURLParams'); |
123 | 123 | $wgHooks['DiffViewHeader'][] = array($wgFlaggedArticle, 'addDiffNoticeAfterEdit' ); |
124 | 124 | # Autoreview stuff |
125 | 125 | $wgHooks['ArticleInsertComplete'][] = array( $wgFlaggedArticle, 'maybeMakeNewPageReviewed' ); |
126 | 126 | $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'maybeMakeEditReviewed' ); |
127 | 127 | $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'autoMarkPatrolled' ); |
| 128 | + # Disallow moves of stable pages |
| 129 | + $wgHooks['userCan'][] = array( $wgFlaggedRevs, 'userCanMove' ); |
128 | 130 | ######### |
129 | 131 | } |
130 | 132 | |
— | — | @@ -1116,7 +1118,7 @@ |
1117 | 1119 | * When an edit is made to a page that can't be reviewed, treat rc_patrolled |
1118 | 1120 | * as 1. This avoids marks showing on edits that cannot be reviewed. |
1119 | 1121 | */ |
1120 | | - function autoMarkPatrolled( $article, $user, $text, $c, $m, $a, $b, $flags, $rev ) { |
| 1122 | + public function autoMarkPatrolled( $article, $user, $text, $c, $m, $a, $b, $flags, $rev ) { |
1121 | 1123 | global $wgFlaggedRevs; |
1122 | 1124 | |
1123 | 1125 | if( !$wgFlaggedRevs->isReviewable( $article->getTitle() ) ) { |
— | — | @@ -1130,6 +1132,26 @@ |
1131 | 1133 | } |
1132 | 1134 | |
1133 | 1135 | /** |
| 1136 | + * Don't let users vandalize pages by moving them. |
| 1137 | + */ |
| 1138 | + public function userCanMove( $title, $user, $action, $result ) { |
| 1139 | + if( $action != 'move' ) |
| 1140 | + return true; |
| 1141 | + # See if there is a stable version |
| 1142 | + $frev = $this->getStableRev( $title ); |
| 1143 | + if( !$frev ) |
| 1144 | + return true; |
| 1145 | + # Allow for only editors/reviewers to move this |
| 1146 | + $right = $frev->fr_quality ? 'validate' : 'review'; |
| 1147 | + if( !$user->isAllowed( $right ) ) { |
| 1148 | + $result = false; |
| 1149 | + return false; |
| 1150 | + } |
| 1151 | + |
| 1152 | + return true; |
| 1153 | + } |
| 1154 | + |
| 1155 | + /** |
1134 | 1156 | * When a new page is made by a reviwer, try to automatically review it. |
1135 | 1157 | */ |
1136 | 1158 | public function maybeMakeNewPageReviewed( $article, $user, $text, $c, $flags, $a, $b, $flags, $rev ) { |
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | # Construct some tagging |
88 | 88 | if( !$wgOut->isPrintable() ) { |
89 | 89 | if( $this->useSimpleUI() ) { |
90 | | - if($revs_since) { |
| 90 | + if( $revs_since ) { |
91 | 91 | $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic'; |
92 | 92 | $tag .= "<span class='fr_tab_current plainlinks'></span>" . |
93 | 93 | wfMsgExt($msg,array('parseinline'), $tfrev->fr_rev_id, $revs_since); |