http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84459

Revision: 84459
Author:   platonides
Date:     2011-03-21 16:46:17 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
(Bug 26223) Concurrently moving an article to different titles leaks a redirect 
revision with no page.
Just the GAID_FOR_UPDATE fixes the issue in my tests, but without the 
transaction there's still potential for inconsistencies.

Modified Paths:
--------------
    trunk/phase3/includes/Title.php

Modified: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     2011-03-21 16:20:24 UTC (rev 84458)
+++ trunk/phase3/includes/Title.php     2011-03-21 16:46:17 UTC (rev 84459)
@@ -3091,13 +3091,16 @@
                        }
                }
 
-               $pageid = $this->getArticleID();
+               $dbw->begin(); # If $file was a LocalFile, its transaction 
would have closed our own.
+               $pageid = $this->getArticleID( GAID_FOR_UPDATE );
                $protected = $this->isProtected();
                $pageCountChange = ( $createRedirect ? 1 : 0 ) - ( 
$nt->exists() ? 1 : 0 );
 
                // Do the actual move
                $err = $this->moveToInternal( $nt, $reason, $createRedirect );
                if ( is_array( $err ) ) {
+                       # FIXME: What about the File we have already moved?
+                       $dbw->rollback();
                        return $err;
                }
 
@@ -3166,6 +3169,8 @@
                $u = new SearchUpdate( $redirid, $this->getPrefixedDBkey(), '' 
);
                $u->doUpdate();
 
+               $dbw->commit();
+               
                # Update site_stats
                if ( $this->isContentPage() && !$nt->isContentPage() ) {
                        # No longer a content page
@@ -3320,7 +3325,7 @@
                        $redirectSuppressed = false;
                } else {
                        // Get rid of old new page entries in Special:NewPages 
and RC.
-                       // Needs to be before $this->resetArticleUD( 0 ).
+                       // Needs to be before $this->resetArticleID( 0 ).
                        $dbw->delete( 'recentchanges', array(
                                        'rc_timestamp' => $dbw->timestamp( 
$this->getEarliestRevTime() ),
                                        'rc_namespace' => $oldns,


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to