r26428 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r26427‎ | r26428 | r26429 >
Date:06:12, 5 October 2007
Author:aaron
Status:old
Tags:
Comment:
*Disallow unprivileged page moves
*Fix error causing review prompt to show for talk pages
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedArticle.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -118,12 +118,14 @@
119119 $wgHooks['ParserAfterTidy'][] = array( $wgFlaggedRevs, 'parserInjectImageTimestamps' );
120120 $wgHooks['OutputPageParserOutput'][] = array( $wgFlaggedRevs, 'outputInjectImageTimestamps');
121121 # Page review on edit
122 - $wgHooks['ArticleUpdateBeforeRedirect'][] = array($wgFlaggedArticle, 'injectReviewDiffURLParams');
 122+ $wgHooks['ArticleUpdateBeforeRedirect'][] = array($wgFlaggedRevs, 'injectReviewDiffURLParams');
123123 $wgHooks['DiffViewHeader'][] = array($wgFlaggedArticle, 'addDiffNoticeAfterEdit' );
124124 # Autoreview stuff
125125 $wgHooks['ArticleInsertComplete'][] = array( $wgFlaggedArticle, 'maybeMakeNewPageReviewed' );
126126 $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'maybeMakeEditReviewed' );
127127 $wgHooks['ArticleSaveComplete'][] = array( $wgFlaggedArticle, 'autoMarkPatrolled' );
 128+ # Disallow moves of stable pages
 129+ $wgHooks['userCan'][] = array( $wgFlaggedRevs, 'userCanMove' );
128130 #########
129131 }
130132
@@ -1116,7 +1118,7 @@
11171119 * When an edit is made to a page that can't be reviewed, treat rc_patrolled
11181120 * as 1. This avoids marks showing on edits that cannot be reviewed.
11191121 */
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 ) {
11211123 global $wgFlaggedRevs;
11221124
11231125 if( !$wgFlaggedRevs->isReviewable( $article->getTitle() ) ) {
@@ -1130,6 +1132,26 @@
11311133 }
11321134
11331135 /**
 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+ /**
11341156 * When a new page is made by a reviwer, try to automatically review it.
11351157 */
11361158 public function maybeMakeNewPageReviewed( $article, $user, $text, $c, $flags, $a, $b, $flags, $rev ) {
Index: trunk/extensions/FlaggedRevs/FlaggedArticle.php
@@ -86,7 +86,7 @@
8787 # Construct some tagging
8888 if( !$wgOut->isPrintable() ) {
8989 if( $this->useSimpleUI() ) {
90 - if($revs_since) {
 90+ if( $revs_since ) {
9191 $msg = $quality ? 'revreview-quick-see-quality' : 'revreview-quick-see-basic';
9292 $tag .= "<span class='fr_tab_current plainlinks'></span>" .
9393 wfMsgExt($msg,array('parseinline'), $tfrev->fr_rev_id, $revs_since);

Status & tagging log