r74421 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r74420‎ | r74421 | r74422 >
Date:14:27, 7 October 2010
Author:yaron
Status:deferred
Tags:
Comment:
Changed so that edits by users with approval permssion always get their edits marked as approved if $egApprovedRevsBlankIfUnapproved is true
Modified paths:
  • /trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php
@@ -48,26 +48,31 @@
4949 }
5050
5151 /**
52 - * If this page already has an approved revision, and the user
53 - * saving this page has approval power, automatically set this
 52+ * If the user saving this page has approval power, and either
 53+ * (a) this page already has an approved revision, or (b) unapproved
 54+ * pages are shown as blank on this wiki, automatically set this
5455 * latest revision to be the approved one - don't bother logging
5556 * the approval, though; the log is reserved for manual approvals.
5657 */
5758 static public function setLatestAsApproved( &$article ) {
5859 $title = $article->getTitle();
59 - $approvedRevID = ApprovedRevs::getApprovedRevID( $title );
60 - if ( empty( $approvedRevID ) ) {
 60+ if ( ! $title->userCan( 'approverevisions' ) ) {
6161 return true;
6262 }
63 - if ( $title->userCan( 'approverevisions' ) ) {
64 - // the rev ID is actually passed in via the hook, but
65 - // it's at the end of a very long set of parameters,
66 - // so for the sake of sanity we'll just re-get it
67 - // here instead
68 - $latestRevisionID = $title->getLatestRevID();
69 - // save approval without logging
70 - ApprovedRevs::saveApprovedRevIDInDB( $title, $latestRevisionID );
 63+
 64+ global $egApprovedRevsBlankIfUnapproved;
 65+ if ( !$egApprovedRevsBlankIfUnapproved ) {
 66+ $approvedRevID = ApprovedRevs::getApprovedRevID( $title );
 67+ if ( empty( $approvedRevID ) ) {
 68+ return true;
 69+ }
7170 }
 71+ // the rev ID is actually passed in via the hook, but it's
 72+ // at the end of a very long set of parameters, so for the
 73+ // sake of sanity we'll just re-get it here instead
 74+ $latestRevisionID = $title->getLatestRevID();
 75+ // save approval without logging
 76+ ApprovedRevs::saveApprovedRevIDInDB( $title, $latestRevisionID );
7277 return true;
7378 }
7479

Status & tagging log