r44493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44492‎ | r44493 | r44494 >
Date:04:55, 12 December 2008
Author:aaron
Status:ok
Tags:
Comment:
(bug 12716) Unprotecting a non-protected page leaves a log entry
Modified paths:
  • /trunk/phase3/includes/Article.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Article.php
@@ -1857,14 +1857,23 @@
18581858 $changed = false;
18591859 foreach( $wgRestrictionTypes as $action ) {
18601860 if( isset( $expiry[$action] ) ) {
1861 - $current[$action] = implode( '', $this->mTitle->getRestrictions( $action ) );
1862 - $changed = ($changed || ($this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action]) );
 1861+ # Get current restrictions on $action
 1862+ $aLimits = $this->mTitle->getRestrictions( $action );
 1863+ $current[$action] = implode( '', $aLimits );
 1864+ # Are any actual restrictions being dealt with here?
 1865+ $aRChanged = count($aLimits) || !empty($limit[$action]);
 1866+ # If something changed, we need to log it. Checking $aRChanged
 1867+ # assures that "unprotecting" a page that is not protected does
 1868+ # not log just because the expiry was "changed".
 1869+ if( $aRChanged && $this->mTitle->mRestrictionsExpiry[$action] != $expiry[$action] ) {
 1870+ $changed = true;
 1871+ }
18631872 }
18641873 }
18651874
18661875 $current = Article::flattenRestrictions( $current );
18671876
1868 - $changed = ($changed || ( $current != $updated ) );
 1877+ $changed = ($changed || $current != $updated );
18691878 $changed = $changed || ($updated && $this->mTitle->areRestrictionsCascading() != $cascade);
18701879 $protect = ( $updated != '' );
18711880

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r30020(bug 12716) Unprotecting a non-protected page leaves a log entrycatrope15:04, 21 January 2008
r31322(bug 13132) Unable to unprotect pages protected with earlier versions of Medi...rotem20:41, 26 February 2008
r36967bug 12716 - trying to unprotect a title that isn't protected no longer genera...demon05:25, 3 July 2008
r36979Replacing the fix for bug 12716.rotem12:25, 3 July 2008

Status & tagging log