From 0a57bad31bc2779f5ff06f458edaa8f578013aa0 Mon Sep 17 00:00:00 2001 From: Huji Date: Fri, 25 Jan 2008 22:45:56 +0000 Subject: [PATCH] (bug 12790) Page protection is not logged when edit-protection is used but move-protection is not --- RELEASE-NOTES | 1 + includes/Article.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index a487b5e18f..59a8b790a2 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -340,6 +340,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Security fix for API on MSIE * (bug 12768) Database query syntax error in maintenance/storage/compressOld.inc * (bug 12753) Empty captions in MediaWiki:Sidebar result in PHP errors +* (bug 12790) Page protection is not logged when edit-protection is used and move-protection is not == Parser changes in 1.12 == diff --git a/includes/Article.php b/includes/Article.php index ce3e402e2e..cf05267d01 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1765,7 +1765,8 @@ class Article { $comment .= "$expiry_description"; if ( $cascade ) $comment .= "$cascade_description"; - + + $rowsAffected = false; # Update restrictions table foreach( $limit as $action => $restrictions ) { if ($restrictions != '' ) { @@ -1773,12 +1774,16 @@ class Article { array( 'pr_page' => $id, 'pr_type' => $action , 'pr_level' => $restrictions, 'pr_cascade' => $cascade ? 1 : 0 , 'pr_expiry' => $encodedExpiry ), __METHOD__ ); + if($dbw->affectedRows() != 0) + $rowsAffected = true; } else { $dbw->delete( 'page_restrictions', array( 'pr_page' => $id, 'pr_type' => $action ), __METHOD__ ); + if($dbw->affectedRows() != 0) + $rowsAffected = true; } } - if($dbw->affectedRows() == 0) + if(!$rowsAffected) // No change return true; @@ -1800,6 +1805,8 @@ class Article { # Update the protection log $log = new LogPage( 'protect' ); + + if( $protect ) { $log->addEntry( $modified ? 'modify' : 'protect', $this->mTitle, trim( $reason . " [$updated]$cascade_description$expiry_description" ) ); -- 2.20.1