From: victorbarbu Date: Mon, 11 Jan 2016 21:52:21 +0000 (+0200) Subject: Use ar_page_id on undeletion X-Git-Tag: 1.31.0-rc.0~8376 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=0aa6486cbff1e0de05a91cb88158588595f4a872;p=lhc%2Fweb%2Fwiklou.git Use ar_page_id on undeletion Bug: T28123 Change-Id: I882b8ba09d68e7475e1d0934328730059574e292 --- diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 00ac127ea0..e3e6e15d41 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1158,6 +1158,7 @@ class WikiPage implements Page, IDBAccessObject { return true; } + /** * Insert a new empty page record for this article. * This *must* be followed up by creating a revision @@ -1166,13 +1167,16 @@ class WikiPage implements Page, IDBAccessObject { * Best if all done inside a transaction. * * @param IDatabase $dbw - * @return int|bool The newly created page_id key; false if the title already existed + * @param int|null $pageId Custom page ID that will be used for the insert statement + * + * @return bool|int The newly created page_id key; false if the title already existed */ - public function insertOn( $dbw ) { + public function insertOn( $dbw, $pageId = null ) { + $pageId = $pageId ?: $dbw->nextSequenceValue( 'page_page_id_seq' ); $dbw->insert( 'page', array( - 'page_id' => $dbw->nextSequenceValue( 'page_page_id_seq' ), + 'page_id' => $pageId, 'page_namespace' => $this->mTitle->getNamespace(), 'page_title' => $this->mTitle->getDBkey(), 'page_restrictions' => '', diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index aada064feb..b36860ff1d 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -568,7 +568,7 @@ class PageArchive { return Status::newFatal( "undeleterevdel" ); } // Safe to insert now... - $newid = $article->insertOn( $dbw ); + $newid = $article->insertOn( $dbw, $row->ar_page_id ); $pageId = $newid; } else { // Check if a deleted revision will become the current revision...