From: jenkins-bot Date: Thu, 4 Oct 2018 18:31:32 +0000 (+0000) Subject: Merge "Update OOUI to v0.29.1" X-Git-Tag: 1.34.0-rc.0~3887 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=109a6ecf78f1735857f1d6bacb26224ef133d223;hp=86ff8ccdcd424d5a381bbf54dcf35195528d8585;p=lhc%2Fweb%2Fwiklou.git Merge "Update OOUI to v0.29.1" --- diff --git a/includes/MovePage.php b/includes/MovePage.php index 2ad315811c..ecd12c6f8e 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -536,7 +536,8 @@ class MovePage { # Save a null revision in the page's history notifying of the move $nullRevision = Revision::newNullRevision( $dbw, $oldid, $comment, true, $user ); if ( !is_object( $nullRevision ) ) { - throw new MWException( 'No valid null revision produced in ' . __METHOD__ ); + throw new MWException( 'Failed to create null revision while moving page ID ' + . $oldid . ' to ' . $nt->getPrefixedDBkey() ); } $nullRevId = $nullRevision->insertOn( $dbw ); diff --git a/includes/Revision.php b/includes/Revision.php index a55b1c4d79..e45c6dce0d 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -1179,7 +1179,7 @@ class Revision implements IDBAccessObject { $rec = self::getRevisionStore()->newNullRevision( $dbw, $title, $comment, $minor, $user ); - return new Revision( $rec ); + return $rec ? new Revision( $rec ) : null; } /** diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index bab1b5e38e..d9db8bd2c2 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -48,6 +48,7 @@ use Psr\Log\LoggerInterface; use Psr\Log\NullLogger; use RecentChange; use Revision; +use RuntimeException; use stdClass; use Title; use User; @@ -1058,13 +1059,15 @@ class RevisionStore ) { $this->checkDatabaseWikiId( $dbw ); + $pageId = $title->getArticleID(); + // T51581: Lock the page table row to ensure no other process // is adding a revision to the page at the same time. // Avoid locking extra tables, compare T191892. $pageLatest = $dbw->selectField( 'page', 'page_latest', - [ 'page_id' => $title->getArticleID() ], + [ 'page_id' => $pageId ], __METHOD__, [ 'FOR UPDATE' ] ); @@ -1081,6 +1084,15 @@ class RevisionStore $title ); + if ( !$oldRevision ) { + $msg = "Failed to load latest revision ID $pageLatest of page ID $pageId."; + $this->logger->error( + $msg, + [ 'exception' => new RuntimeException( $msg ) ] + ); + return null; + } + // Construct the new revision $timestamp = wfTimestampNow(); // TODO: use a callback, so we can override it for testing. $newRevision = MutableRevisionRecord::newFromParentRevision( $oldRevision );