r59166 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59165‎ | r59166 | r59167 >
Date:01:52, 17 November 2009
Author:aaron
Status:ok
Tags:
Comment:
bug 21528 Added missing article existence check for protect UI
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php
@@ -1827,7 +1827,7 @@
18281828 // Code stolen from Stabilization (which was stolen from ProtectionForm)
18291829 public static function onProtectionForm( $article, &$output ) {
18301830 global $wgUser, $wgRequest, $wgOut, $wgLang;
1831 - if( !FlaggedRevs::useProtectionLevels() ) {
 1831+ if( !FlaggedRevs::useProtectionLevels() || !$article->exists() ) {
18321832 return true; // nothing to do
18331833 } else if( !FlaggedRevs::isPageReviewable( $article->getTitle() ) ) {
18341834 return true; // not a reviewable page
@@ -1955,7 +1955,7 @@
19561956
19571957 // Add stability log extract to protection form
19581958 public static function insertStabilityLog( $article, $out ) {
1959 - if( !FlaggedRevs::useProtectionLevels() ) {
 1959+ if( !FlaggedRevs::useProtectionLevels() || !$article->exists() ) {
19601960 return true; // nothing to do
19611961 } else if( !FlaggedRevs::isPageReviewable( $article->getTitle() ) ) {
19621962 return true; // not a reviewable page
@@ -1970,7 +1970,7 @@
19711971 public static function onProtectionSave( $article, &$errorMsg ) {
19721972 global $wgUser, $wgRequest;
19731973 $levels = FlaggedRevs::getProtectionLevels();
1974 - if( empty($levels) )
 1974+ if( empty($levels) || !$article->exists() )
19751975 return true; // simple custom levels set for action=protect
19761976 if( wfReadOnly() || !$wgUser->isAllowed('stablesettings') ) {
19771977 return true; // user cannot change anything

Status & tagging log