From: Aaron Schulz Date: Fri, 12 Dec 2008 04:55:11 +0000 (+0000) Subject: (bug 12716) Unprotecting a non-protected page leaves a log entry X-Git-Tag: 1.31.0-rc.0~44019 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=531074df1d1670b1a75b1f8b22c9e916641b18d1;p=lhc%2Fweb%2Fwiklou.git (bug 12716) Unprotecting a non-protected page leaves a log entry --- diff --git a/includes/Article.php b/includes/Article.php index 523f9eb90a..eb8f329aa3 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1857,14 +1857,23 @@ class Article { $changed = false; foreach( $wgRestrictionTypes as $action ) { if( isset( $expiry[$action] ) ) { - $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) ); - $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) ); + # Get current restrictions on $action + $aLimits = $this->mTitle->getRestrictions( $action ); + $current[$action] = implode( '', $aLimits ); + # Are any actual restrictions being dealt with here? + $aRChanged = count($aLimits) || !empty($limit[$action]); + # If something changed, we need to log it. Checking $aRChanged + # assures that "unprotecting" a page that is not protected does + # not log just because the expiry was "changed". + if( $aRChanged && $this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action] ) { + $changed = true; + } } } $current = Article::flattenRestrictions( $current ); - $changed = ($changed || ( $current != $updated ) ); + $changed = ($changed || $current != $updated ); $changed = $changed || ($updated && $this->mTitle->areRestrictionsCascading() != $cascade); $protect = ( $updated != '' );