From ff31d6eb39627f47429a187ca1528470e2106ea1 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 1 Nov 2012 12:12:11 +0100 Subject: [PATCH] (Bug 41617) Fix undelete. Undeletion was broken twice: 1) originally, it failed silently, restoring revision entries with the wrong number in rev_page. 2) I789e45bd restores an overly zealous sanity check, causing undeletion to fail with a fatal error. This change fixes both issues. Change-Id: I796fe54e81773f7982ae9bc15ba30f2a2ee3f174 --- includes/Revision.php | 5 +++-- includes/specials/SpecialUndelete.php | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/Revision.php b/includes/Revision.php index 431be69dc1..1ab44bf7d0 100644 --- a/includes/Revision.php +++ b/includes/Revision.php @@ -606,8 +606,9 @@ class Revision implements IDBAccessObject { // if the page ID wasn't known, set it now $this->mPage = $this->mTitle->getArticleID(); } elseif ( $this->mTitle->getArticleID() !== $this->mPage ) { - // got different page IDs, something is wrong. - throw new MWException( "Page ID " . $this->mPage . " mismatches the ID " + // Got different page IDs. This may be legit (e.g. during undeletion), + // but it seems worth mentioning it in the log. + wfDebug( "Page ID " . $this->mPage . " mismatches the ID " . $this->mTitle->getArticleID() . " provided by the Title object." ); } } diff --git a/includes/specials/SpecialUndelete.php b/includes/specials/SpecialUndelete.php index 4c38a781ba..c0420e56c2 100644 --- a/includes/specials/SpecialUndelete.php +++ b/includes/specials/SpecialUndelete.php @@ -575,6 +575,9 @@ class PageArchive { return Status::newFatal( "undeleterevdel" ); } } + + $newid = false; + $pageId = $article->getId(); } $revision = null; @@ -593,6 +596,7 @@ class PageArchive { // unless we are specifically removing all restrictions... $revision = Revision::newFromArchiveRow( $row, array( + 'page' => $pageId, 'title' => $this->title, 'deleted' => $unsuppress ? 0 : $row->ar_deleted ) ); -- 2.20.1