r48665 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48664‎ | r48665 | r48666 >
Date:01:16, 22 March 2009
Author:aaron
Status:ok
Tags:
Comment:
RevisionDelete - Improved handling of page moves
Modified paths:
  • /trunk/phase3/includes/specials/SpecialRevisiondelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialRevisiondelete.php
@@ -38,12 +38,6 @@
3939 $this->fileids = $wgRequest->getArray( 'fileid' );
4040 # For reviewing deleted files...
4141 $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 - }
4842 # Only one target set at a time please!
4943 $i = (bool)$this->file + (bool)$this->oldids + (bool)$this->logids
5044 + (bool)$this->artimestamps + (bool)$this->fileids + (bool)$this->oldimgs;
@@ -51,6 +45,18 @@
5246 $wgOut->showErrorPage( 'revdelete-toomanytargets-title', 'revdelete-toomanytargets-text' );
5347 return;
5448 }
 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+ }
5561 # Logs must have a type given
5662 if( $this->logids && !strpos($this->page->getDBKey(),'/') ) {
5763 $wgOut->showErrorPage( 'revdelete-nologtype-title', 'revdelete-nologtype-text' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r48681Expand on r48665 - include multi-rev caseaaron13:22, 22 March 2009

Status & tagging log