Merge "Handle edge case in WikiPage::lock()"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 8 Oct 2015 15:51:12 +0000 (15:51 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 8 Oct 2015 15:51:12 +0000 (15:51 +0000)
1  2 
includes/page/WikiPage.php

@@@ -2797,15 -2787,11 +2799,12 @@@ class WikiPage implements Page, IDBAcce
                        // WikiPage::READ_LOCKING as that will carry over the FOR UPDATE to
                        // the revisions queries (which also JOIN on user). Only lock the page
                        // row and CAS check on page_latest to see if the trx snapshot matches.
-                       $latest = $this->lock();
-                       $this->loadPageData( WikiPage::READ_LATEST );
-                       $id = $this->getID();
-                       if ( $id == 0 || $this->getLatest() != $latest ) {
+                       $lockedLatest = $this->lock();
+                       if ( $id == 0 || $this->getLatest() != $lockedLatest ) {
                                // Page not there or trx snapshot is stale
                                $dbw->rollback( __METHOD__ );
 -                              $status->error( 'cannotdelete', wfEscapeWikiText( $this->getTitle()->getPrefixedText() ) );
 +                              $status->error( 'cannotdelete',
 +                                      wfEscapeWikiText( $this->getTitle()->getPrefixedText() ) );
                                return $status;
                        }
                }