Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php |
— | — | @@ -38,12 +38,6 @@ |
39 | 39 | $this->fileids = $wgRequest->getArray( 'fileid' ); |
40 | 40 | # For reviewing deleted files... |
41 | 41 | $this->file = $wgRequest->getVal( 'file' ); |
42 | | - # If this is a revision, then we need a target page |
43 | | - $this->page = Title::newFromUrl( $this->target ); |
44 | | - if( is_null($this->page) ) { |
45 | | - $wgOut->addWikiMsg( 'undelete-header' ); |
46 | | - return; |
47 | | - } |
48 | 42 | # Only one target set at a time please! |
49 | 43 | $i = (bool)$this->file + (bool)$this->oldids + (bool)$this->logids |
50 | 44 | + (bool)$this->artimestamps + (bool)$this->fileids + (bool)$this->oldimgs; |
— | — | @@ -51,6 +45,18 @@ |
52 | 46 | $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' ); |
53 | 47 | return; |
54 | 48 | } |
| 49 | + $this->page = Title::newFromUrl( $this->target ); |
| 50 | + # If this is just one revision, get the title from it. |
| 51 | + # This allows for more flexibility with page moves... |
| 52 | + if( count($this->oldids) === 1 ) { |
| 53 | + $rev = Revision::newFromId( $this->oldids[0] ); |
| 54 | + $this->page = $rev ? $rev->getTitle() : $this->page; |
| 55 | + } |
| 56 | + # We need a target page! |
| 57 | + if( is_null($this->page) ) { |
| 58 | + $wgOut->addWikiMsg( 'undelete-header' ); |
| 59 | + return; |
| 60 | + } |
55 | 61 | # Logs must have a type given |
56 | 62 | if( $this->logids && !strpos($this->page->getDBKey(),'/') ) { |
57 | 63 | $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' ); |