Fall back to autoincrement when page cannot be recreated with old ID
authorGergő Tisza <tgr.huwiki@gmail.com>
Tue, 12 Jan 2016 03:09:24 +0000 (19:09 -0800)
committerGergő Tisza <gtisza@wikimedia.org>
Tue, 12 Jan 2016 03:36:09 +0000 (03:36 +0000)
Fixes I882b8ba09d68e7475e1d0934328730059574e292.

Bug: T28123
Change-Id: Ib029407d8e21f041803131143ff4dc0856803c60

includes/specials/SpecialUndelete.php

index b36860f..744a090 100644 (file)
@@ -569,6 +569,10 @@ class PageArchive {
                        }
                        // Safe to insert now...
                        $newid = $article->insertOn( $dbw, $row->ar_page_id );
+                       if ( $newid === false ) {
+                               // The old ID is reserved; let's pick another
+                               $newid = $article->insertOn( $dbw );
+                       }
                        $pageId = $newid;
                } else {
                        // Check if a deleted revision will become the current revision...