Index: trunk/extensions/ApprovedRevs/ApprovedRevs.hooks.php |
— | — | @@ -48,26 +48,31 @@ |
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
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 |
54 | 55 | * latest revision to be the approved one - don't bother logging |
55 | 56 | * the approval, though; the log is reserved for manual approvals. |
56 | 57 | */ |
57 | 58 | static public function setLatestAsApproved( &$article ) { |
58 | 59 | $title = $article->getTitle(); |
59 | | - $approvedRevID = ApprovedRevs::getApprovedRevID( $title ); |
60 | | - if ( empty( $approvedRevID ) ) { |
| 60 | + if ( ! $title->userCan( 'approverevisions' ) ) { |
61 | 61 | return true; |
62 | 62 | } |
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 | + } |
71 | 70 | } |
| 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 ); |
72 | 77 | return true; |
73 | 78 | } |
74 | 79 | |