From 825650e78396fe960e6a1d1706981e918d312f3a Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 22 Mar 2009 01:16:15 +0000 Subject: [PATCH] RevisionDelete - Improved handling of page moves --- includes/specials/SpecialRevisiondelete.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php index 249984d179..9e367f5dd1 100644 --- a/includes/specials/SpecialRevisiondelete.php +++ b/includes/specials/SpecialRevisiondelete.php @@ -38,12 +38,6 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $this->fileids = $wgRequest->getArray( 'fileid' ); # For reviewing deleted files... $this->file = $wgRequest->getVal( 'file' ); - # If this is a revision, then we need a target page - $this->page = Title::newFromUrl( $this->target ); - if( is_null($this->page) ) { - $wgOut->addWikiMsg( 'undelete-header' ); - return; - } # Only one target set at a time please! $i = (bool)$this->file + (bool)$this->oldids + (bool)$this->logids + (bool)$this->artimestamps + (bool)$this->fileids + (bool)$this->oldimgs; @@ -51,6 +45,18 @@ class SpecialRevisionDelete extends UnlistedSpecialPage { $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' ); return; } + $this->page = Title::newFromUrl( $this->target ); + # If this is just one revision, get the title from it. + # This allows for more flexibility with page moves... + if( count($this->oldids) === 1 ) { + $rev = Revision::newFromId( $this->oldids[0] ); + $this->page = $rev ? $rev->getTitle() : $this->page; + } + # We need a target page! + if( is_null($this->page) ) { + $wgOut->addWikiMsg( 'undelete-header' ); + return; + } # Logs must have a type given if( $this->logids && !strpos($this->page->getDBKey(),'/') ) { $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' ); -- 2.20.1