* (bug 8632) Fix regression in page protection null edit update
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 14 Jan 2007 12:03:56 +0000 (12:03 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 14 Jan 2007 12:03:56 +0000 (12:03 +0000)
r19095 removed the code that updated the page record's cache timestamp and revision number, leaving the wrong page_latest reference.
Putting it back, merging in the other query to clean out the old page_restrictions field.

RELEASE-NOTES
includes/Article.php

index cd55c09..d089ae7 100644 (file)
@@ -65,6 +65,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Unmaintained Oracle support files have been removed.
 * Made Linker::userToolLinks() show the contribs link red when the user has zero edits
 * Use browser default for printing size, don't force to 11pt
+* (bug 8632) Fix regression in page protection null edit update
 
 
 == Languages updated ==
index ed7746d..ab6ad0a 100644 (file)
@@ -1673,7 +1673,7 @@ class Article {
                                if( $protect )
                                        $comment .= " [$updated]";
                                $nullRevision = Revision::newNullRevision( $dbw, $id, $comment, true );
-                               $nullRevision->insertOn( $dbw );
+                               $nullRevId = $nullRevision->insertOn( $dbw );
 
                                # Update restrictions table
                                foreach( $limit as $action => $restrictions ) {
@@ -1687,11 +1687,16 @@ class Article {
                                        }
                                }
 
-                               # Blank page_restrictions on page record if they're being used.
-                               if ($this->mTitle->mOldRestrictions) {
-                                       $dbw->update( 'page', array ( 'page_restrictions' => '' ), array ( 'page_id' => $id ), __METHOD__ );
-                               }
-                       
+                               # Update page record
+                               $dbw->update( 'page',
+                                       array( /* SET */
+                                               'page_touched' => $dbw->timestamp(),
+                                               'page_restrictions' => '',
+                                               'page_latest' => $nullRevId
+                                       ), array( /* WHERE */
+                                               'page_id' => $id
+                                       ), 'Article::protect'
+                               );
                                wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) );
        
                                # Update the protection log