(bug 12790) Page protection is not logged when edit-protection is used but move-prote...
authorHuji <huji@users.mediawiki.org>
Fri, 25 Jan 2008 22:45:56 +0000 (22:45 +0000)
committerHuji <huji@users.mediawiki.org>
Fri, 25 Jan 2008 22:45:56 +0000 (22:45 +0000)
RELEASE-NOTES
includes/Article.php

index a487b5e..59a8b79 100644 (file)
@@ -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 ==
 
index ce3e402..cf05267 100644 (file)
@@ -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" ) );