3 * Implements Special:Undelete
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
21 * @ingroup SpecialPage
25 * Used to show archived pages and eventually restore them.
27 * @ingroup SpecialPage
34 protected $fileStatus;
37 protected $revisionStatus;
42 function __construct( $title, Config
$config = null ) {
43 if ( is_null( $title ) ) {
44 throw new MWException( __METHOD__
. ' given a null title.' );
46 $this->title
= $title;
47 if ( $config === null ) {
48 wfDebug( __METHOD__
. ' did not have a Config object passed to it' );
49 $config = ConfigFactory
::getDefaultInstance()->makeConfig( 'main' );
51 $this->config
= $config;
55 * List all deleted pages recorded in the archive table. Returns result
56 * wrapper with (ar_namespace, ar_title, count) fields, ordered by page
59 * @return ResultWrapper
61 public static function listAllPages() {
62 $dbr = wfGetDB( DB_SLAVE
);
64 return self
::listPages( $dbr, '' );
68 * List deleted pages recorded in the archive table matching the
70 * Returns result wrapper with (ar_namespace, ar_title, count) fields.
72 * @param string $prefix Title prefix
73 * @return ResultWrapper
75 public static function listPagesByPrefix( $prefix ) {
76 $dbr = wfGetDB( DB_SLAVE
);
78 $title = Title
::newFromText( $prefix );
80 $ns = $title->getNamespace();
81 $prefix = $title->getDBkey();
83 // Prolly won't work too good
84 // @todo handle bare namespace names cleanly?
89 'ar_namespace' => $ns,
90 'ar_title' . $dbr->buildLike( $prefix, $dbr->anyString() ),
93 return self
::listPages( $dbr, $conds );
97 * @param IDatabase $dbr
98 * @param string|array $condition
99 * @return bool|ResultWrapper
101 protected static function listPages( $dbr, $condition ) {
107 'count' => 'COUNT(*)'
112 'GROUP BY' => array( 'ar_namespace', 'ar_title' ),
113 'ORDER BY' => array( 'ar_namespace', 'ar_title' ),
120 * List the revisions of the given page. Returns result wrapper with
121 * (ar_minor_edit, ar_timestamp, ar_user, ar_user_text, ar_comment) fields.
123 * @return ResultWrapper
125 function listRevisions() {
126 $dbr = wfGetDB( DB_SLAVE
);
128 $tables = array( 'archive' );
131 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text',
132 'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1',
135 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
136 $fields[] = 'ar_content_format';
137 $fields[] = 'ar_content_model';
140 $conds = array( 'ar_namespace' => $this->title
->getNamespace(),
141 'ar_title' => $this->title
->getDBkey() );
143 $options = array( 'ORDER BY' => 'ar_timestamp DESC' );
145 $join_conds = array();
147 ChangeTags
::modifyDisplayQuery(
155 return $dbr->select( $tables,
165 * List the deleted file revisions for this page, if it's a file page.
166 * Returns a result wrapper with various filearchive fields, or null
167 * if not a file page.
169 * @return ResultWrapper
170 * @todo Does this belong in Image for fuller encapsulation?
172 function listFiles() {
173 if ( $this->title
->getNamespace() != NS_FILE
) {
177 $dbr = wfGetDB( DB_SLAVE
);
180 ArchivedFile
::selectFields(),
181 array( 'fa_name' => $this->title
->getDBkey() ),
183 array( 'ORDER BY' => 'fa_timestamp DESC' )
188 * Return a Revision object containing data for the deleted revision.
189 * Note that the result *may* or *may not* have a null page ID.
191 * @param string $timestamp
192 * @return Revision|null
194 function getRevision( $timestamp ) {
195 $dbr = wfGetDB( DB_SLAVE
);
212 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
213 $fields[] = 'ar_content_format';
214 $fields[] = 'ar_content_model';
217 $row = $dbr->selectRow( 'archive',
219 array( 'ar_namespace' => $this->title
->getNamespace(),
220 'ar_title' => $this->title
->getDBkey(),
221 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
225 return Revision
::newFromArchiveRow( $row, array( 'title' => $this->title
) );
232 * Return the most-previous revision, either live or deleted, against
233 * the deleted revision given by timestamp.
235 * May produce unexpected results in case of history merges or other
236 * unusual time issues.
238 * @param string $timestamp
239 * @return Revision|null Null when there is no previous revision
241 function getPreviousRevision( $timestamp ) {
242 $dbr = wfGetDB( DB_SLAVE
);
244 // Check the previous deleted revision...
245 $row = $dbr->selectRow( 'archive',
247 array( 'ar_namespace' => $this->title
->getNamespace(),
248 'ar_title' => $this->title
->getDBkey(),
250 $dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
253 'ORDER BY' => 'ar_timestamp DESC',
255 $prevDeleted = $row ?
wfTimestamp( TS_MW
, $row->ar_timestamp
) : false;
257 $row = $dbr->selectRow( array( 'page', 'revision' ),
258 array( 'rev_id', 'rev_timestamp' ),
260 'page_namespace' => $this->title
->getNamespace(),
261 'page_title' => $this->title
->getDBkey(),
262 'page_id = rev_page',
264 $dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
267 'ORDER BY' => 'rev_timestamp DESC',
269 $prevLive = $row ?
wfTimestamp( TS_MW
, $row->rev_timestamp
) : false;
270 $prevLiveId = $row ?
intval( $row->rev_id
) : null;
272 if ( $prevLive && $prevLive > $prevDeleted ) {
273 // Most prior revision was live
274 return Revision
::newFromId( $prevLiveId );
275 } elseif ( $prevDeleted ) {
276 // Most prior revision was deleted
277 return $this->getRevision( $prevDeleted );
280 // No prior revision on this page.
285 * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
287 * @param object $row Database row
290 function getTextFromRow( $row ) {
291 if ( is_null( $row->ar_text_id
) ) {
292 // An old row from MediaWiki 1.4 or previous.
293 // Text is embedded in this row in classic compression format.
294 return Revision
::getRevisionText( $row, 'ar_' );
297 // New-style: keyed to the text storage backend.
298 $dbr = wfGetDB( DB_SLAVE
);
299 $text = $dbr->selectRow( 'text',
300 array( 'old_text', 'old_flags' ),
301 array( 'old_id' => $row->ar_text_id
),
304 return Revision
::getRevisionText( $text );
308 * Fetch (and decompress if necessary) the stored text of the most
309 * recently edited deleted revision of the page.
311 * If there are no archived revisions for the page, returns NULL.
313 * @return string|null
315 function getLastRevisionText() {
316 $dbr = wfGetDB( DB_SLAVE
);
317 $row = $dbr->selectRow( 'archive',
318 array( 'ar_text', 'ar_flags', 'ar_text_id' ),
319 array( 'ar_namespace' => $this->title
->getNamespace(),
320 'ar_title' => $this->title
->getDBkey() ),
322 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
325 return $this->getTextFromRow( $row );
332 * Quick check if any archived revisions are present for the page.
336 function isDeleted() {
337 $dbr = wfGetDB( DB_SLAVE
);
338 $n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
339 array( 'ar_namespace' => $this->title
->getNamespace(),
340 'ar_title' => $this->title
->getDBkey() ),
348 * Restore the given (or all) text and file revisions for the page.
349 * Once restored, the items will be removed from the archive tables.
350 * The deletion log will be updated with an undeletion notice.
352 * @param array $timestamps Pass an empty array to restore all revisions,
353 * otherwise list the ones to undelete.
354 * @param string $comment
355 * @param array $fileVersions
356 * @param bool $unsuppress
357 * @param User $user User performing the action, or null to use $wgUser
358 * @return array(number of file revisions restored, number of image revisions
359 * restored, log message) on success, false on failure.
361 function undelete( $timestamps, $comment = '', $fileVersions = array(),
362 $unsuppress = false, User
$user = null
364 // If both the set of text revisions and file revisions are empty,
365 // restore everything. Otherwise, just restore the requested items.
366 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
368 $restoreText = $restoreAll ||
!empty( $timestamps );
369 $restoreFiles = $restoreAll ||
!empty( $fileVersions );
371 if ( $restoreFiles && $this->title
->getNamespace() == NS_FILE
) {
372 $img = wfLocalFile( $this->title
);
373 $this->fileStatus
= $img->restore( $fileVersions, $unsuppress );
374 if ( !$this->fileStatus
->isOK() ) {
377 $filesRestored = $this->fileStatus
->successCount
;
382 if ( $restoreText ) {
383 $this->revisionStatus
= $this->undeleteRevisions( $timestamps, $unsuppress, $comment );
384 if ( !$this->revisionStatus
->isOK() ) {
388 $textRestored = $this->revisionStatus
->getValue();
395 if ( $textRestored && $filesRestored ) {
396 $reason = wfMessage( 'undeletedrevisions-files' )
397 ->numParams( $textRestored, $filesRestored )->inContentLanguage()->text();
398 } elseif ( $textRestored ) {
399 $reason = wfMessage( 'undeletedrevisions' )->numParams( $textRestored )
400 ->inContentLanguage()->text();
401 } elseif ( $filesRestored ) {
402 $reason = wfMessage( 'undeletedfiles' )->numParams( $filesRestored )
403 ->inContentLanguage()->text();
405 wfDebug( "Undelete: nothing undeleted...\n" );
410 if ( trim( $comment ) != '' ) {
411 $reason .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
414 if ( $user === null ) {
419 $logEntry = new ManualLogEntry( 'delete', 'restore' );
420 $logEntry->setPerformer( $user );
421 $logEntry->setTarget( $this->title
);
422 $logEntry->setComment( $reason );
424 Hooks
::run( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) );
426 $logid = $logEntry->insert();
427 $logEntry->publish( $logid );
429 return array( $textRestored, $filesRestored, $reason );
433 * This is the meaty bit -- restores archived revisions of the given page
434 * to the cur/old tables. If the page currently exists, all revisions will
435 * be stuffed into old, otherwise the most recent will go into cur.
437 * @param array $timestamps Pass an empty array to restore all revisions,
438 * otherwise list the ones to undelete.
439 * @param bool $unsuppress Remove all ar_deleted/fa_deleted restrictions of seletected revs
440 * @param string $comment
441 * @throws ReadOnlyError
442 * @return Status Status object containing the number of revisions restored on success
444 private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) {
445 if ( wfReadOnly() ) {
446 throw new ReadOnlyError();
449 $restoreAll = empty( $timestamps );
450 $dbw = wfGetDB( DB_MASTER
);
452 # Does this page already exist? We'll have to update it...
453 $article = WikiPage
::factory( $this->title
);
454 # Load latest data for the current page (bug 31179)
455 $article->loadPageData( 'fromdbmaster' );
456 $oldcountable = $article->isCountable();
458 $page = $dbw->selectRow( 'page',
459 array( 'page_id', 'page_latest' ),
460 array( 'page_namespace' => $this->title
->getNamespace(),
461 'page_title' => $this->title
->getDBkey() ),
463 array( 'FOR UPDATE' ) // lock page
468 # Page already exists. Import the history, and if necessary
469 # we'll update the latest revision field in the record.
471 $previousRevId = $page->page_latest
;
473 # Get the time span of this page
474 $previousTimestamp = $dbw->selectField( 'revision', 'rev_timestamp',
475 array( 'rev_id' => $previousRevId ),
478 if ( $previousTimestamp === false ) {
479 wfDebug( __METHOD__
. ": existing page refers to a page_latest that does not exist\n" );
481 $status = Status
::newGood( 0 );
482 $status->warning( 'undeleterevision-missing' );
487 # Have to create a new article...
490 $previousTimestamp = 0;
494 'ar_namespace' => $this->title
->getNamespace(),
495 'ar_title' => $this->title
->getDBkey(),
497 if ( !$restoreAll ) {
498 $oldWhere['ar_timestamp'] = array_map( array( &$dbw, 'timestamp' ), $timestamps );
517 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
518 $fields[] = 'ar_content_format';
519 $fields[] = 'ar_content_model';
523 * Select each archived revision...
525 $result = $dbw->select( 'archive',
529 /* options */ array( 'ORDER BY' => 'ar_timestamp' )
532 $rev_count = $result->numRows();
534 wfDebug( __METHOD__
. ": no revisions to restore\n" );
536 $status = Status
::newGood( 0 );
537 $status->warning( "undelete-no-results" );
542 $result->seek( $rev_count - 1 ); // move to last
543 $row = $result->fetchObject(); // get newest archived rev
544 $oldPageId = (int)$row->ar_page_id
; // pass this to ArticleUndelete hook
545 $result->seek( 0 ); // move back
547 // grab the content to check consistency with global state before restoring the page.
548 $revision = Revision
::newFromArchiveRow( $row,
550 'title' => $article->getTitle(), // used to derive default content model
553 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
554 $content = $revision->getContent( Revision
::RAW
);
556 //NOTE: article ID may not be known yet. prepareSave() should not modify the database.
557 $status = $content->prepareSave( $article, 0, -1, $user );
559 if ( !$status->isOK() ) {
564 // Check the state of the newest to-be version...
565 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
566 return Status
::newFatal( "undeleterevdel" );
568 // Safe to insert now...
569 $newid = $article->insertOn( $dbw );
572 // Check if a deleted revision will become the current revision...
573 if ( $row->ar_timestamp
> $previousTimestamp ) {
574 // Check the state of the newest to-be version...
575 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
576 return Status
::newFatal( "undeleterevdel" );
581 $pageId = $article->getId();
587 foreach ( $result as $row ) {
588 // Check for key dupes due to shitty archive integrity.
589 if ( $row->ar_rev_id
) {
590 $exists = $dbw->selectField( 'revision', '1',
591 array( 'rev_id' => $row->ar_rev_id
), __METHOD__
);
593 continue; // don't throw DB errors
596 // Insert one revision at a time...maintaining deletion status
597 // unless we are specifically removing all restrictions...
598 $revision = Revision
::newFromArchiveRow( $row,
601 'title' => $this->title
,
602 'deleted' => $unsuppress ?
0 : $row->ar_deleted
605 $revision->insertOn( $dbw );
608 Hooks
::run( 'ArticleRevisionUndeleted', array( &$this->title
, $revision, $row->ar_page_id
) );
610 # Now that it's safely stored, take it out of the archive
611 $dbw->delete( 'archive',
615 // Was anything restored at all?
616 if ( $restored == 0 ) {
617 return Status
::newGood( 0 );
620 $created = (bool)$newid;
622 // Attach the latest revision to the page...
623 $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
624 if ( $created ||
$wasnew ) {
625 // Update site stats, link tables, etc
626 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
627 $article->doEditUpdates(
630 array( 'created' => $created, 'oldcountable' => $oldcountable )
634 Hooks
::run( 'ArticleUndelete', array( &$this->title
, $created, $comment, $oldPageId ) );
636 if ( $this->title
->getNamespace() == NS_FILE
) {
637 $update = new HTMLCacheUpdate( $this->title
, 'imagelinks' );
641 return Status
::newGood( $restored );
647 function getFileStatus() {
648 return $this->fileStatus
;
654 function getRevisionStatus() {
655 return $this->revisionStatus
;
660 * Special page allowing users with the appropriate permissions to view
661 * and restore deleted content.
663 * @ingroup SpecialPage
665 class SpecialUndelete
extends SpecialPage
{
672 private $mTargetTimestamp;
681 function __construct() {
682 parent
::__construct( 'Undelete', 'deletedhistory' );
685 function loadRequest( $par ) {
686 $request = $this->getRequest();
687 $user = $this->getUser();
689 $this->mAction
= $request->getVal( 'action' );
690 if ( $par !== null && $par !== '' ) {
691 $this->mTarget
= $par;
693 $this->mTarget
= $request->getVal( 'target' );
696 $this->mTargetObj
= null;
698 if ( $this->mTarget
!== null && $this->mTarget
!== '' ) {
699 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
702 $this->mSearchPrefix
= $request->getText( 'prefix' );
703 $time = $request->getVal( 'timestamp' );
704 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
705 $this->mFilename
= $request->getVal( 'file' );
707 $posted = $request->wasPosted() &&
708 $user->matchEditToken( $request->getVal( 'wpEditToken' ) );
709 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
710 $this->mInvert
= $request->getCheck( 'invert' ) && $posted;
711 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
712 $this->mDiff
= $request->getCheck( 'diff' );
713 $this->mDiffOnly
= $request->getBool( 'diffonly', $this->getUser()->getOption( 'diffonly' ) );
714 $this->mComment
= $request->getText( 'wpComment' );
715 $this->mUnsuppress
= $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' );
716 $this->mToken
= $request->getVal( 'token' );
718 if ( $this->isAllowed( 'undelete' ) && !$user->isBlocked() ) {
719 $this->mAllowed
= true; // user can restore
720 $this->mCanView
= true; // user can view content
721 } elseif ( $this->isAllowed( 'deletedtext' ) ) {
722 $this->mAllowed
= false; // user cannot restore
723 $this->mCanView
= true; // user can view content
724 $this->mRestore
= false;
725 } else { // user can only view the list of revisions
726 $this->mAllowed
= false;
727 $this->mCanView
= false;
728 $this->mTimestamp
= '';
729 $this->mRestore
= false;
732 if ( $this->mRestore ||
$this->mInvert
) {
733 $timestamps = array();
734 $this->mFileVersions
= array();
735 foreach ( $request->getValues() as $key => $val ) {
737 if ( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
738 array_push( $timestamps, $matches[1] );
741 if ( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
742 $this->mFileVersions
[] = intval( $matches[1] );
745 rsort( $timestamps );
746 $this->mTargetTimestamp
= $timestamps;
751 * Checks whether a user is allowed the permission for the
752 * specific title if one is set.
754 * @param string $permission
758 private function isAllowed( $permission, User
$user = null ) {
759 $user = $user ?
: $this->getUser();
760 if ( $this->mTargetObj
!== null ) {
761 return $this->mTargetObj
->userCan( $permission, $user );
763 return $user->isAllowed( $permission );
767 function userCanExecute( User
$user ) {
768 return $this->isAllowed( $this->mRestriction
, $user );
771 function execute( $par ) {
772 $user = $this->getUser();
775 $this->outputHeader();
777 $this->loadRequest( $par );
778 $this->checkPermissions(); // Needs to be after mTargetObj is set
780 $out = $this->getOutput();
782 if ( is_null( $this->mTargetObj
) ) {
783 $out->addWikiMsg( 'undelete-header' );
785 # Not all users can just browse every deleted page from the list
786 if ( $user->isAllowed( 'browsearchive' ) ) {
787 $this->showSearchForm();
793 if ( $this->mAllowed
) {
794 $out->setPageTitle( $this->msg( 'undeletepage' ) );
796 $out->setPageTitle( $this->msg( 'viewdeletedpage' ) );
799 $this->getSkin()->setRelevantTitle( $this->mTargetObj
);
801 if ( $this->mTimestamp
!== '' ) {
802 $this->showRevision( $this->mTimestamp
);
803 } elseif ( $this->mFilename
!== null && $this->mTargetObj
->inNamespace( NS_FILE
) ) {
804 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
805 // Check if user is allowed to see this file
806 if ( !$file->exists() ) {
807 $out->addWikiMsg( 'filedelete-nofile', $this->mFilename
);
808 } elseif ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
809 if ( $file->isDeleted( File
::DELETED_RESTRICTED
) ) {
810 throw new PermissionsError( 'suppressrevision' );
812 throw new PermissionsError( 'deletedtext' );
814 } elseif ( !$user->matchEditToken( $this->mToken
, $this->mFilename
) ) {
815 $this->showFileConfirmationForm( $this->mFilename
);
817 $this->showFile( $this->mFilename
);
819 } elseif ( $this->mRestore
&& $this->mAction
== 'submit' ) {
822 $this->showHistory();
826 function showSearchForm() {
827 $out = $this->getOutput();
828 $out->setPageTitle( $this->msg( 'undelete-search-title' ) );
830 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) .
831 Xml
::fieldset( $this->msg( 'undelete-search-box' )->text() ) .
832 Html
::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
835 array( 'for' => 'prefix' ),
836 $this->msg( 'undelete-search-prefix' )->parse()
841 $this->mSearchPrefix
,
842 array( 'id' => 'prefix', 'autofocus' => true )
844 Xml
::submitButton( $this->msg( 'undelete-search-submit' )->text() ) .
845 Xml
::closeElement( 'fieldset' ) .
846 Xml
::closeElement( 'form' )
849 # List undeletable articles
850 if ( $this->mSearchPrefix
) {
851 $result = PageArchive
::listPagesByPrefix( $this->mSearchPrefix
);
852 $this->showList( $result );
857 * Generic list of deleted pages
859 * @param ResultWrapper $result
862 private function showList( $result ) {
863 $out = $this->getOutput();
865 if ( $result->numRows() == 0 ) {
866 $out->addWikiMsg( 'undelete-no-results' );
871 $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );
873 $undelete = $this->getPageTitle();
874 $out->addHTML( "<ul>\n" );
875 foreach ( $result as $row ) {
876 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
877 if ( $title !== null ) {
878 $item = Linker
::linkKnown(
880 htmlspecialchars( $title->getPrefixedText() ),
882 array( 'target' => $title->getPrefixedText() )
885 // The title is no longer valid, show as text
886 $item = Html
::element(
888 array( 'class' => 'mw-invalidtitle' ),
889 Linker
::getInvalidTitleDescription(
896 $revs = $this->msg( 'undeleterevisions' )->numParams( $row->count
)->parse();
897 $out->addHTML( "<li>{$item} ({$revs})</li>\n" );
900 $out->addHTML( "</ul>\n" );
905 private function showRevision( $timestamp ) {
906 if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
910 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
911 if ( !Hooks
::run( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj
) ) ) {
914 $rev = $archive->getRevision( $timestamp );
916 $out = $this->getOutput();
917 $user = $this->getUser();
920 $out->addWikiMsg( 'undeleterevision-missing' );
925 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
926 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
928 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
929 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
930 'rev-suppressed-text-permission' : 'rev-deleted-text-permission'
937 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
938 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
939 'rev-suppressed-text-view' : 'rev-deleted-text-view'
941 $out->addHTML( '<br />' );
942 // and we are allowed to see...
945 if ( $this->mDiff
) {
946 $previousRev = $archive->getPreviousRevision( $timestamp );
947 if ( $previousRev ) {
948 $this->showDiff( $previousRev, $rev );
949 if ( $this->mDiffOnly
) {
953 $out->addHTML( '<hr />' );
955 $out->addWikiMsg( 'undelete-nodiff' );
959 $link = Linker
::linkKnown(
960 $this->getPageTitle( $this->mTargetObj
->getPrefixedDBkey() ),
961 htmlspecialchars( $this->mTargetObj
->getPrefixedText() )
964 $lang = $this->getLanguage();
966 // date and time are separate parameters to facilitate localisation.
967 // $time is kept for backward compat reasons.
968 $time = $lang->userTimeAndDate( $timestamp, $user );
969 $d = $lang->userDate( $timestamp, $user );
970 $t = $lang->userTime( $timestamp, $user );
971 $userLink = Linker
::revUserTools( $rev );
973 $content = $rev->getContent( Revision
::FOR_THIS_USER
, $user );
975 $isText = ( $content instanceof TextContent
);
977 if ( $this->mPreview ||
$isText ) {
978 $openDiv = '<div id="mw-undelete-revision" class="mw-warning">';
980 $openDiv = '<div id="mw-undelete-revision">';
982 $out->addHTML( $openDiv );
984 // Revision delete links
985 if ( !$this->mDiff
) {
986 $revdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
988 $out->addHTML( "$revdel " );
992 $out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params(
993 $time )->rawParams( $userLink )->params( $d, $t )->parse() . '</div>' );
995 if ( !Hooks
::run( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) ) ) {
999 if ( $this->mPreview ||
!$isText ) {
1000 // NOTE: non-text content has no source view, so always use rendered preview
1003 $popts = $out->parserOptions();
1004 $popts->setEditSection( false );
1006 $pout = $content->getParserOutput( $this->mTargetObj
, $rev->getId(), $popts, true );
1007 $out->addParserOutput( $pout );
1011 // source view for textual content
1012 $sourceView = Xml
::element(
1015 'readonly' => 'readonly',
1016 'cols' => $user->getIntOption( 'cols' ),
1017 'rows' => $user->getIntOption( 'rows' )
1019 $content->getNativeData() . "\n"
1022 $previewButton = Xml
::element( 'input', array(
1024 'name' => 'preview',
1025 'value' => $this->msg( 'showpreview' )->text()
1029 $previewButton = '';
1032 $diffButton = Xml
::element( 'input', array(
1035 'value' => $this->msg( 'showdiff' )->text() ) );
1039 Xml
::openElement( 'div', array(
1040 'style' => 'clear: both' ) ) .
1041 Xml
::openElement( 'form', array(
1043 'action' => $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ) ) ) .
1044 Xml
::element( 'input', array(
1047 'value' => $this->mTargetObj
->getPrefixedDBkey() ) ) .
1048 Xml
::element( 'input', array(
1050 'name' => 'timestamp',
1051 'value' => $timestamp ) ) .
1052 Xml
::element( 'input', array(
1054 'name' => 'wpEditToken',
1055 'value' => $user->getEditToken() ) ) .
1058 Xml
::closeElement( 'form' ) .
1059 Xml
::closeElement( 'div' )
1064 * Build a diff display between this and the previous either deleted
1065 * or non-deleted edit.
1067 * @param Revision $previousRev
1068 * @param Revision $currentRev
1069 * @return string HTML
1071 function showDiff( $previousRev, $currentRev ) {
1072 $diffContext = clone $this->getContext();
1073 $diffContext->setTitle( $currentRev->getTitle() );
1074 $diffContext->setWikiPage( WikiPage
::factory( $currentRev->getTitle() ) );
1076 $diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
1077 $diffEngine->showDiffStyle();
1079 $formattedDiff = $diffEngine->generateContentDiffBody(
1080 $previousRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() ),
1081 $currentRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() )
1084 $formattedDiff = $diffEngine->addHeader(
1086 $this->diffHeader( $previousRev, 'o' ),
1087 $this->diffHeader( $currentRev, 'n' )
1090 $this->getOutput()->addHTML( "<div>$formattedDiff</div>\n" );
1094 * @param Revision $rev
1095 * @param string $prefix
1098 private function diffHeader( $rev, $prefix ) {
1099 $isDeleted = !( $rev->getId() && $rev->getTitle() );
1101 /// @todo FIXME: $rev->getTitle() is null for deleted revs...?
1102 $targetPage = $this->getPageTitle();
1103 $targetQuery = array(
1104 'target' => $this->mTargetObj
->getPrefixedText(),
1105 'timestamp' => wfTimestamp( TS_MW
, $rev->getTimestamp() )
1108 /// @todo FIXME: getId() may return non-zero for deleted revs...
1109 $targetPage = $rev->getTitle();
1110 $targetQuery = array( 'oldid' => $rev->getId() );
1113 // Add show/hide deletion links if available
1114 $user = $this->getUser();
1115 $lang = $this->getLanguage();
1116 $rdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1122 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1124 $tags = wfGetDB( DB_SLAVE
)->selectField(
1127 array( 'ts_rev_id' => $rev->getId() ),
1130 $tagSummary = ChangeTags
::formatSummaryRow( $tags, 'deleteddiff' );
1132 // FIXME This is reimplementing DifferenceEngine#getRevisionHeader
1133 // and partially #showDiffPage, but worse
1134 return '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
1139 $lang->userTimeAndDate( $rev->getTimestamp(), $user ),
1140 $lang->userDate( $rev->getTimestamp(), $user ),
1141 $lang->userTime( $rev->getTimestamp(), $user )
1147 '<div id="mw-diff-' . $prefix . 'title2">' .
1148 Linker
::revUserTools( $rev ) . '<br />' .
1150 '<div id="mw-diff-' . $prefix . 'title3">' .
1151 $minor . Linker
::revComment( $rev ) . $rdel . '<br />' .
1153 '<div id="mw-diff-' . $prefix . 'title5">' .
1154 $tagSummary[0] . '<br />' .
1159 * Show a form confirming whether a tokenless user really wants to see a file
1160 * @param string $key
1162 private function showFileConfirmationForm( $key ) {
1163 $out = $this->getOutput();
1164 $lang = $this->getLanguage();
1165 $user = $this->getUser();
1166 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
1167 $out->addWikiMsg( 'undelete-show-file-confirm',
1168 $this->mTargetObj
->getText(),
1169 $lang->userDate( $file->getTimestamp(), $user ),
1170 $lang->userTime( $file->getTimestamp(), $user ) );
1172 Xml
::openElement( 'form', array(
1174 'action' => $this->getPageTitle()->getLocalURL( array(
1175 'target' => $this->mTarget
,
1177 'token' => $user->getEditToken( $key ),
1181 Xml
::submitButton( $this->msg( 'undelete-show-file-submit' )->text() ) .
1187 * Show a deleted file version requested by the visitor.
1188 * @param string $key
1190 private function showFile( $key ) {
1191 $this->getOutput()->disable();
1193 # We mustn't allow the output to be Squid cached, otherwise
1194 # if an admin previews a deleted image, and it's cached, then
1195 # a user without appropriate permissions can toddle off and
1196 # nab the image, and Squid will serve it
1197 $response = $this->getRequest()->response();
1198 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1199 $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1200 $response->header( 'Pragma: no-cache' );
1202 $repo = RepoGroup
::singleton()->getLocalRepo();
1203 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
1204 $repo->streamFile( $path );
1207 private function showHistory() {
1208 $out = $this->getOutput();
1209 if ( $this->mAllowed
) {
1210 $out->addModules( 'mediawiki.special.undelete' );
1213 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
1214 array( 'undeletepagetitle', wfEscapeWikiText( $this->mTargetObj
->getPrefixedText() ) )
1217 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1218 Hooks
::run( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj
) );
1220 $text = $archive->getLastRevisionText();
1221 if( is_null( $text ) ) {
1222 $out->addWikiMsg( 'nohistory' );
1226 $out->addHTML( '<div class="mw-undelete-history">' );
1227 if ( $this->mAllowed
) {
1228 $out->addWikiMsg( 'undeletehistory' );
1229 $out->addWikiMsg( 'undeleterevdel' );
1231 $out->addWikiMsg( 'undeletehistorynoadmin' );
1233 $out->addHTML( '</div>' );
1235 # List all stored revisions
1236 $revisions = $archive->listRevisions();
1237 $files = $archive->listFiles();
1239 $haveRevisions = $revisions && $revisions->numRows() > 0;
1240 $haveFiles = $files && $files->numRows() > 0;
1242 # Batch existence check on user and talk pages
1243 if ( $haveRevisions ) {
1244 $batch = new LinkBatch();
1245 foreach ( $revisions as $row ) {
1246 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
1247 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
1250 $revisions->seek( 0 );
1253 $batch = new LinkBatch();
1254 foreach ( $files as $row ) {
1255 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
1256 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
1262 if ( $this->mAllowed
) {
1263 $action = $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) );
1264 # Start the form here
1265 $top = Xml
::openElement(
1267 array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' )
1269 $out->addHTML( $top );
1272 # Show relevant lines from the deletion log:
1273 $deleteLogPage = new LogPage( 'delete' );
1274 $out->addHTML( Xml
::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
1275 LogEventsList
::showLogExtract( $out, 'delete', $this->mTargetObj
);
1276 # Show relevant lines from the suppression log:
1277 $suppressLogPage = new LogPage( 'suppress' );
1278 if ( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
1279 $out->addHTML( Xml
::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
1280 LogEventsList
::showLogExtract( $out, 'suppress', $this->mTargetObj
);
1283 if ( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
1284 # Format the user-visible controls (comment field, submission button)
1285 # in a nice little table
1286 if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
1290 <td class='mw-input'>" .
1291 Xml
::checkLabel( $this->msg( 'revdelete-unsuppress' )->text(),
1292 'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress
) .
1296 $unsuppressBox = '';
1299 $table = Xml
::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
1300 Xml
::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
1302 <td colspan='2' class='mw-undelete-extrahelp'>" .
1303 $this->msg( 'undeleteextrahelp' )->parseAsBlock() .
1307 <td class='mw-label'>" .
1308 Xml
::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
1310 <td class='mw-input'>" .
1315 array( 'id' => 'wpComment', 'autofocus' => true )
1321 <td class='mw-submit'>" .
1323 $this->msg( 'undeletebtn' )->text(),
1324 array( 'name' => 'restore', 'id' => 'mw-undelete-submit' )
1327 $this->msg( 'undeleteinvert' )->text(),
1328 array( 'name' => 'invert', 'id' => 'mw-undelete-invert' )
1333 Xml
::closeElement( 'table' ) .
1334 Xml
::closeElement( 'fieldset' );
1336 $out->addHTML( $table );
1339 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" );
1341 if ( $haveRevisions ) {
1342 # The page's stored (deleted) history:
1343 $out->addHTML( '<ul>' );
1344 $remaining = $revisions->numRows();
1345 $earliestLiveTime = $this->mTargetObj
->getEarliestRevTime();
1347 foreach ( $revisions as $row ) {
1349 $out->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining ) );
1352 $out->addHTML( '</ul>' );
1354 $out->addWikiMsg( 'nohistory' );
1358 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'filehist' )->text() ) . "\n" );
1359 $out->addHTML( '<ul>' );
1360 foreach ( $files as $row ) {
1361 $out->addHTML( $this->formatFileRow( $row ) );
1364 $out->addHTML( '</ul>' );
1367 if ( $this->mAllowed
) {
1368 # Slip in the hidden controls here
1369 $misc = Html
::hidden( 'target', $this->mTarget
);
1370 $misc .= Html
::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
1371 $misc .= Xml
::closeElement( 'form' );
1372 $out->addHTML( $misc );
1378 private function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
1379 $rev = Revision
::newFromArchiveRow( $row,
1381 'title' => $this->mTargetObj
1385 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
1386 // Build checkboxen...
1387 if ( $this->mAllowed
) {
1388 if ( $this->mInvert
) {
1389 if ( in_array( $ts, $this->mTargetTimestamp
) ) {
1390 $checkBox = Xml
::check( "ts$ts" );
1392 $checkBox = Xml
::check( "ts$ts", true );
1395 $checkBox = Xml
::check( "ts$ts" );
1401 // Build page & diff links...
1402 $user = $this->getUser();
1403 if ( $this->mCanView
) {
1404 $titleObj = $this->getPageTitle();
1406 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $this->getUser() ) ) {
1407 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1408 $last = $this->msg( 'diff' )->escaped();
1409 } elseif ( $remaining > 0 ||
( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1410 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1411 $last = Linker
::linkKnown(
1413 $this->msg( 'diff' )->escaped(),
1416 'target' => $this->mTargetObj
->getPrefixedText(),
1422 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1423 $last = $this->msg( 'diff' )->escaped();
1426 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1427 $last = $this->msg( 'diff' )->escaped();
1431 $userLink = Linker
::revUserTools( $rev );
1434 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1436 // Revision text size
1437 $size = $row->ar_len
;
1438 if ( !is_null( $size ) ) {
1439 $revTextSize = Linker
::formatRevisionSize( $size );
1443 $comment = Linker
::revComment( $rev );
1447 list( $tagSummary, $classes ) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'deletedhistory' );
1449 $attribs['class'] = implode( ' ', $classes );
1452 // Revision delete links
1453 $revdlink = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1455 $revisionRow = $this->msg( 'undelete-revision-row' )
1469 return Xml
::tags( 'li', $attribs, $revisionRow ) . "\n";
1472 private function formatFileRow( $row ) {
1473 $file = ArchivedFile
::newFromRow( $row );
1474 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
1475 $user = $this->getUser();
1478 if ( $this->mCanView
&& $row->fa_storage_key
) {
1479 if ( $this->mAllowed
) {
1480 $checkBox = Xml
::check( 'fileid' . $row->fa_id
);
1482 $key = urlencode( $row->fa_storage_key
);
1483 $pageLink = $this->getFileLink( $file, $this->getPageTitle(), $ts, $key );
1485 $pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user );
1487 $userLink = $this->getFileUser( $file );
1488 $data = $this->msg( 'widthheight' )->numParams( $row->fa_width
, $row->fa_height
)->text();
1489 $bytes = $this->msg( 'parentheses' )
1490 ->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size
)->text() )
1492 $data = htmlspecialchars( $data . ' ' . $bytes );
1493 $comment = $this->getFileComment( $file );
1495 // Add show/hide deletion links if available
1496 $canHide = $this->isAllowed( 'deleterevision' );
1497 if ( $canHide ||
( $file->getVisibility() && $this->isAllowed( 'deletedhistory' ) ) ) {
1498 if ( !$file->userCan( File
::DELETED_RESTRICTED
, $user ) ) {
1499 // Revision was hidden from sysops
1500 $revdlink = Linker
::revDeleteLinkDisabled( $canHide );
1503 'type' => 'filearchive',
1504 'target' => $this->mTargetObj
->getPrefixedDBkey(),
1505 'ids' => $row->fa_id
1507 $revdlink = Linker
::revDeleteLink( $query,
1508 $file->isDeleted( File
::DELETED_RESTRICTED
), $canHide );
1514 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1518 * Fetch revision text link if it's available to all users
1520 * @param Revision $rev
1521 * @param Title $titleObj
1522 * @param string $ts Timestamp
1525 function getPageLink( $rev, $titleObj, $ts ) {
1526 $user = $this->getUser();
1527 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1529 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
1530 return '<span class="history-deleted">' . $time . '</span>';
1533 $link = Linker
::linkKnown(
1535 htmlspecialchars( $time ),
1538 'target' => $this->mTargetObj
->getPrefixedText(),
1543 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
1544 $link = '<span class="history-deleted">' . $link . '</span>';
1551 * Fetch image view link if it's available to all users
1553 * @param File|ArchivedFile $file
1554 * @param Title $titleObj
1555 * @param string $ts A timestamp
1556 * @param string $key A storage key
1558 * @return string HTML fragment
1560 function getFileLink( $file, $titleObj, $ts, $key ) {
1561 $user = $this->getUser();
1562 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1564 if ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
1565 return '<span class="history-deleted">' . $time . '</span>';
1568 $link = Linker
::linkKnown(
1570 htmlspecialchars( $time ),
1573 'target' => $this->mTargetObj
->getPrefixedText(),
1575 'token' => $user->getEditToken( $key )
1579 if ( $file->isDeleted( File
::DELETED_FILE
) ) {
1580 $link = '<span class="history-deleted">' . $link . '</span>';
1587 * Fetch file's user id if it's available to this user
1589 * @param File|ArchivedFile $file
1590 * @return string HTML fragment
1592 function getFileUser( $file ) {
1593 if ( !$file->userCan( File
::DELETED_USER
, $this->getUser() ) ) {
1594 return '<span class="history-deleted">' .
1595 $this->msg( 'rev-deleted-user' )->escaped() .
1599 $link = Linker
::userLink( $file->getRawUser(), $file->getRawUserText() ) .
1600 Linker
::userToolLinks( $file->getRawUser(), $file->getRawUserText() );
1602 if ( $file->isDeleted( File
::DELETED_USER
) ) {
1603 $link = '<span class="history-deleted">' . $link . '</span>';
1610 * Fetch file upload comment if it's available to this user
1612 * @param File|ArchivedFile $file
1613 * @return string HTML fragment
1615 function getFileComment( $file ) {
1616 if ( !$file->userCan( File
::DELETED_COMMENT
, $this->getUser() ) ) {
1617 return '<span class="history-deleted"><span class="comment">' .
1618 $this->msg( 'rev-deleted-comment' )->escaped() . '</span></span>';
1621 $link = Linker
::commentBlock( $file->getRawDescription() );
1623 if ( $file->isDeleted( File
::DELETED_COMMENT
) ) {
1624 $link = '<span class="history-deleted">' . $link . '</span>';
1630 function undelete() {
1631 if ( $this->getConfig()->get( 'UploadMaintenance' )
1632 && $this->mTargetObj
->getNamespace() == NS_FILE
1634 throw new ErrorPageError( 'undelete-error', 'filedelete-maintenance' );
1637 if ( wfReadOnly() ) {
1638 throw new ReadOnlyError
;
1641 $out = $this->getOutput();
1642 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1643 Hooks
::run( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj
) );
1644 $ok = $archive->undelete(
1645 $this->mTargetTimestamp
,
1647 $this->mFileVersions
,
1652 if ( is_array( $ok ) ) {
1653 if ( $ok[1] ) { // Undeleted file count
1654 Hooks
::run( 'FileUndeleteComplete', array(
1655 $this->mTargetObj
, $this->mFileVersions
,
1656 $this->getUser(), $this->mComment
) );
1659 $link = Linker
::linkKnown( $this->mTargetObj
);
1660 $out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
1662 $out->setPageTitle( $this->msg( 'undelete-error' ) );
1665 // Show revision undeletion warnings and errors
1666 $status = $archive->getRevisionStatus();
1667 if ( $status && !$status->isGood() ) {
1668 $out->addWikiText( '<div class="error">' .
1669 $status->getWikiText(
1676 // Show file undeletion warnings and errors
1677 $status = $archive->getFileStatus();
1678 if ( $status && !$status->isGood() ) {
1679 $out->addWikiText( '<div class="error">' .
1680 $status->getWikiText(
1681 'undelete-error-short',
1682 'undelete-error-long'
1688 protected function getGroupName() {