Update the WikiPage object with the new ID when undeleting
authorThis, that and the other <at.light@live.com.au>
Tue, 12 Jan 2016 13:30:33 +0000 (00:30 +1100)
committerThis, that and the other <at.light@live.com.au>
Tue, 12 Jan 2016 13:30:33 +0000 (00:30 +1100)
Issue introduced by 0aa6486cbff1e0de05a91cb88158588595f4a872.

Change-Id: I2c4fde5e66f280a6bc2de1b13453f1c40385a20d

includes/page/WikiPage.php

index e3e6e15..7bd87f7 100644 (file)
@@ -1172,11 +1172,11 @@ class WikiPage implements Page, IDBAccessObject {
         * @return bool|int The newly created page_id key; false if the title already existed
         */
        public function insertOn( $dbw, $pageId = null ) {
-               $pageId = $pageId ?: $dbw->nextSequenceValue( 'page_page_id_seq' );
+               $pageIdForInsert = $pageId ?: $dbw->nextSequenceValue( 'page_page_id_seq' );
                $dbw->insert(
                        'page',
                        array(
-                               'page_id'           => $pageId,
+                               'page_id'           => $pageIdForInsert,
                                'page_namespace'    => $this->mTitle->getNamespace(),
                                'page_title'        => $this->mTitle->getDBkey(),
                                'page_restrictions' => '',
@@ -1192,7 +1192,7 @@ class WikiPage implements Page, IDBAccessObject {
                );
 
                if ( $dbw->affectedRows() > 0 ) {
-                       $newid = $dbw->insertId();
+                       $newid = $pageId ?: $dbw->insertId();
                        $this->mId = $newid;
                        $this->mTitle->resetArticleID( $newid );