* @ingroup SpecialPage
*/
class SpecialUndelete extends SpecialPage {
- private $mAction;
+ private $mAction;
private $mTarget;
private $mTimestamp;
private $mRestore;
+ private $mRevdel;
private $mInvert;
private $mFilename;
- private $mTargetTimestamp;
+ private $mTargetTimestamp;
private $mAllowed;
private $mCanView;
private $mComment;
$posted = $request->wasPosted() &&
$user->matchEditToken( $request->getVal( 'wpEditToken' ) );
$this->mRestore = $request->getCheck( 'restore' ) && $posted;
+ $this->mRevdel = $request->getCheck( 'revdel' ) && $posted;
$this->mInvert = $request->getCheck( 'invert' ) && $posted;
$this->mPreview = $request->getCheck( 'preview' ) && $posted;
$this->mDiff = $request->getCheck( 'diff' );
} else {
$this->showFile( $this->mFilename );
}
- } elseif ( $this->mRestore && $this->mAction == 'submit' ) {
- $this->undelete();
+ } elseif ( $this->mAction === "submit" ) {
+ if ( $this->mRestore ) {
+ $this->undelete();
+ } elseif ( $this->mRevdel ) {
+ $this->redirectToRevDel();
+ }
+
} else {
$this->showHistory();
}
}
+ /**
+ * Convert submitted form data to format expected by RevisionDelete and
+ * redirect the request
+ */
+ private function redirectToRevDel() {
+ $archive = new PageArchive( $this->mTargetObj );
+
+ $revisions = array();
+
+ foreach ( $this->getRequest()->getValues() as $key => $val ) {
+ $matches = array();
+ if ( preg_match( "/^ts(\d{14})$/", $key, $matches ) ) {
+ $revisions[ $archive->getRevision( $matches[1] )->getId() ] = 1;
+ }
+ }
+ $query = array(
+ "type" => "revision",
+ "ids" => $revisions,
+ "target" => wfUrlencode( $this->mTargetObj->getPrefixedText() )
+ );
+ $url = SpecialPage::getTitleFor( "RevisionDelete" )->getFullURL( $query );
+ $this->getOutput()->redirect( $url );
+ }
+
function showSearchForm() {
$out = $this->getOutput();
$out->setPageTitle( $this->msg( 'undelete-search-title' ) );
$out->addHTML( Xml::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" );
if ( $haveRevisions ) {
- # The page's stored (deleted) history:
+ # Show the page's stored (deleted) history
+
+ if ( $this->getUser()->isAllowed( 'deleterevision' ) ) {
+ $out->addHTML( Html::element(
+ 'button',
+ array(
+ 'name' => 'revdel',
+ 'type' => 'submit',
+ 'class' => 'deleterevision-log-submit mw-log-deleterevision-button'
+ ),
+ $this->msg( 'showhideselectedversions' )->text()
+ ) . "\n" );
+ }
+
$out->addHTML( '<ul>' );
$remaining = $revisions->numRows();
$earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
$attribs['class'] = implode( ' ', $classes );
}
- // Revision delete links
- $revdlink = Linker::getRevDeleteLink( $user, $rev, $this->mTargetObj );
-
- $revisionRow = $this->msg( 'undelete-revision-row' )
+ $revisionRow = $this->msg( 'undelete-revision-row2' )
->rawParams(
$checkBox,
- $revdlink,
$last,
$pageLink,
$userLink,
"undelete-error-long": "Errors were encountered while undeleting the file:\n\n$1",
"undelete-show-file-confirm": "Are you sure you want to view the deleted revision of the file \"<nowiki>$1</nowiki>\" from $2 at $3?",
"undelete-show-file-submit": "Yes",
- "undelete-revision-row": "$1 $2 ($3) $4 . . $5 $6 $7 $8 $9",
+ "undelete-revision-row2": "$1 ($2) $3 . . $4 $5 $6 $7 $8",
"namespace": "Namespace:",
"invert": "Invert selection",
"tooltip-invert": "Check this box to hide changes to pages within the selected namespace (and the associated namespace if checked)",
"undelete-error-long": "Used as error message. Parameters:\n* $1 - ...\nSee also:\n* {{msg-mw|Undelete-error-short}}",
"undelete-show-file-confirm": "A confirmation message shown on [[Special:Undelete]] when the request does not contain a valid token (e.g. when a user clicks a link received in mail).\n\nParameters:\n* $1 - the name of the file being undeleted\n* $2 - the date of the displayed revision\n* $3 - the time of the displayed revision\n{{Identical|Are you sure you want to view the deleted revision of the file...}}",
"undelete-show-file-submit": "{{Identical|Yes}}",
- "undelete-revision-row": "{{Optional}}\nA revision row in the undelete page. Parameters:\n* $1 is a checkBox to indicate whether to restore this specific revision\n* $2 is a link to the revision\n* $3 is a link to the last revision of a page ({{msg-mw|last}})\n* $4 is a link to the page\n* $5 is a link to the revision's user\n* $6 is the revision's minor edit identifier\n* $7 is the revision size\n* $8 is the revision comment\n* $9 is the revision's tags",
+ "undelete-revision-row2": "{{Optional}}\nA revision row in the undelete page. Parameters:\n* $1 is a checkBox to indicate whether to restore this specific revision\n* $2 is a link to the last revision of a page ({{msg-mw|last}})\n* $3 is a link to the page\n* $4 is a link to the revision's user\n* $5 is the revision's minor edit identifier\n* $6 is the revision size\n* $7 is the revision comment\n* $8 is the revision's tags",
"namespace": "This message is located at [[Special:Contributions]].\n{{Identical|Namespace}}",
"invert": "Displayed in [[Special:RecentChanges|RecentChanges]], [[Special:RecentChangesLinked|RecentChangesLinked]] and [[Special:Watchlist|Watchlist]].\n\nThis message means \"Invert selection of namespace\".\n\nThis message has a tooltip {{msg-mw|tooltip-invert}}\n{{Identical|Invert selection}}",
"tooltip-invert": "Used in [[Special:Recentchanges]] as a tooltip for the invert checkbox. See also the message {{msg-mw|invert}}",