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(
156 return $dbr->select( $tables,
166 * List the deleted file revisions for this page, if it's a file page.
167 * Returns a result wrapper with various filearchive fields, or null
168 * if not a file page.
170 * @return ResultWrapper
171 * @todo Does this belong in Image for fuller encapsulation?
173 function listFiles() {
174 if ( $this->title
->getNamespace() != NS_FILE
) {
178 $dbr = wfGetDB( DB_SLAVE
);
181 ArchivedFile
::selectFields(),
182 array( 'fa_name' => $this->title
->getDBkey() ),
184 array( 'ORDER BY' => 'fa_timestamp DESC' )
189 * Return a Revision object containing data for the deleted revision.
190 * Note that the result *may* or *may not* have a null page ID.
192 * @param string $timestamp
193 * @return Revision|null
195 function getRevision( $timestamp ) {
196 $dbr = wfGetDB( DB_SLAVE
);
213 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
214 $fields[] = 'ar_content_format';
215 $fields[] = 'ar_content_model';
218 $row = $dbr->selectRow( 'archive',
220 array( 'ar_namespace' => $this->title
->getNamespace(),
221 'ar_title' => $this->title
->getDBkey(),
222 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
226 return Revision
::newFromArchiveRow( $row, array( 'title' => $this->title
) );
233 * Return the most-previous revision, either live or deleted, against
234 * the deleted revision given by timestamp.
236 * May produce unexpected results in case of history merges or other
237 * unusual time issues.
239 * @param string $timestamp
240 * @return Revision|null Null when there is no previous revision
242 function getPreviousRevision( $timestamp ) {
243 $dbr = wfGetDB( DB_SLAVE
);
245 // Check the previous deleted revision...
246 $row = $dbr->selectRow( 'archive',
248 array( 'ar_namespace' => $this->title
->getNamespace(),
249 'ar_title' => $this->title
->getDBkey(),
251 $dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
254 'ORDER BY' => 'ar_timestamp DESC',
256 $prevDeleted = $row ?
wfTimestamp( TS_MW
, $row->ar_timestamp
) : false;
258 $row = $dbr->selectRow( array( 'page', 'revision' ),
259 array( 'rev_id', 'rev_timestamp' ),
261 'page_namespace' => $this->title
->getNamespace(),
262 'page_title' => $this->title
->getDBkey(),
263 'page_id = rev_page',
265 $dbr->addQuotes( $dbr->timestamp( $timestamp ) ) ),
268 'ORDER BY' => 'rev_timestamp DESC',
270 $prevLive = $row ?
wfTimestamp( TS_MW
, $row->rev_timestamp
) : false;
271 $prevLiveId = $row ?
intval( $row->rev_id
) : null;
273 if ( $prevLive && $prevLive > $prevDeleted ) {
274 // Most prior revision was live
275 return Revision
::newFromId( $prevLiveId );
276 } elseif ( $prevDeleted ) {
277 // Most prior revision was deleted
278 return $this->getRevision( $prevDeleted );
281 // No prior revision on this page.
286 * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
288 * @param object $row Database row
291 function getTextFromRow( $row ) {
292 if ( is_null( $row->ar_text_id
) ) {
293 // An old row from MediaWiki 1.4 or previous.
294 // Text is embedded in this row in classic compression format.
295 return Revision
::getRevisionText( $row, 'ar_' );
298 // New-style: keyed to the text storage backend.
299 $dbr = wfGetDB( DB_SLAVE
);
300 $text = $dbr->selectRow( 'text',
301 array( 'old_text', 'old_flags' ),
302 array( 'old_id' => $row->ar_text_id
),
305 return Revision
::getRevisionText( $text );
309 * Fetch (and decompress if necessary) the stored text of the most
310 * recently edited deleted revision of the page.
312 * If there are no archived revisions for the page, returns NULL.
314 * @return string|null
316 function getLastRevisionText() {
317 $dbr = wfGetDB( DB_SLAVE
);
318 $row = $dbr->selectRow( 'archive',
319 array( 'ar_text', 'ar_flags', 'ar_text_id' ),
320 array( 'ar_namespace' => $this->title
->getNamespace(),
321 'ar_title' => $this->title
->getDBkey() ),
323 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
326 return $this->getTextFromRow( $row );
333 * Quick check if any archived revisions are present for the page.
337 function isDeleted() {
338 $dbr = wfGetDB( DB_SLAVE
);
339 $n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
340 array( 'ar_namespace' => $this->title
->getNamespace(),
341 'ar_title' => $this->title
->getDBkey() ),
349 * Restore the given (or all) text and file revisions for the page.
350 * Once restored, the items will be removed from the archive tables.
351 * The deletion log will be updated with an undeletion notice.
353 * @param array $timestamps Pass an empty array to restore all revisions,
354 * otherwise list the ones to undelete.
355 * @param string $comment
356 * @param array $fileVersions
357 * @param bool $unsuppress
358 * @param User $user User performing the action, or null to use $wgUser
359 * @return array(number of file revisions restored, number of image revisions
360 * restored, log message) on success, false on failure.
362 function undelete( $timestamps, $comment = '', $fileVersions = array(),
363 $unsuppress = false, User
$user = null
365 // If both the set of text revisions and file revisions are empty,
366 // restore everything. Otherwise, just restore the requested items.
367 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
369 $restoreText = $restoreAll ||
!empty( $timestamps );
370 $restoreFiles = $restoreAll ||
!empty( $fileVersions );
372 if ( $restoreFiles && $this->title
->getNamespace() == NS_FILE
) {
373 $img = wfLocalFile( $this->title
);
374 $img->load( File
::READ_LATEST
);
375 $this->fileStatus
= $img->restore( $fileVersions, $unsuppress );
376 if ( !$this->fileStatus
->isOK() ) {
379 $filesRestored = $this->fileStatus
->successCount
;
384 if ( $restoreText ) {
385 $this->revisionStatus
= $this->undeleteRevisions( $timestamps, $unsuppress, $comment );
386 if ( !$this->revisionStatus
->isOK() ) {
390 $textRestored = $this->revisionStatus
->getValue();
397 if ( $textRestored && $filesRestored ) {
398 $reason = wfMessage( 'undeletedrevisions-files' )
399 ->numParams( $textRestored, $filesRestored )->inContentLanguage()->text();
400 } elseif ( $textRestored ) {
401 $reason = wfMessage( 'undeletedrevisions' )->numParams( $textRestored )
402 ->inContentLanguage()->text();
403 } elseif ( $filesRestored ) {
404 $reason = wfMessage( 'undeletedfiles' )->numParams( $filesRestored )
405 ->inContentLanguage()->text();
407 wfDebug( "Undelete: nothing undeleted...\n" );
412 if ( trim( $comment ) != '' ) {
413 $reason .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
416 if ( $user === null ) {
421 $logEntry = new ManualLogEntry( 'delete', 'restore' );
422 $logEntry->setPerformer( $user );
423 $logEntry->setTarget( $this->title
);
424 $logEntry->setComment( $reason );
426 Hooks
::run( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) );
428 $logid = $logEntry->insert();
429 $logEntry->publish( $logid );
431 return array( $textRestored, $filesRestored, $reason );
435 * This is the meaty bit -- restores archived revisions of the given page
436 * to the cur/old tables. If the page currently exists, all revisions will
437 * be stuffed into old, otherwise the most recent will go into cur.
439 * @param array $timestamps Pass an empty array to restore all revisions,
440 * otherwise list the ones to undelete.
441 * @param bool $unsuppress Remove all ar_deleted/fa_deleted restrictions of seletected revs
442 * @param string $comment
443 * @throws ReadOnlyError
444 * @return Status Status object containing the number of revisions restored on success
446 private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) {
447 if ( wfReadOnly() ) {
448 throw new ReadOnlyError();
451 $restoreAll = empty( $timestamps );
452 $dbw = wfGetDB( DB_MASTER
);
454 # Does this page already exist? We'll have to update it...
455 $article = WikiPage
::factory( $this->title
);
456 # Load latest data for the current page (bug 31179)
457 $article->loadPageData( 'fromdbmaster' );
458 $oldcountable = $article->isCountable();
460 $page = $dbw->selectRow( 'page',
461 array( 'page_id', 'page_latest' ),
462 array( 'page_namespace' => $this->title
->getNamespace(),
463 'page_title' => $this->title
->getDBkey() ),
465 array( 'FOR UPDATE' ) // lock page
470 # Page already exists. Import the history, and if necessary
471 # we'll update the latest revision field in the record.
473 $previousRevId = $page->page_latest
;
475 # Get the time span of this page
476 $previousTimestamp = $dbw->selectField( 'revision', 'rev_timestamp',
477 array( 'rev_id' => $previousRevId ),
480 if ( $previousTimestamp === false ) {
481 wfDebug( __METHOD__
. ": existing page refers to a page_latest that does not exist\n" );
483 $status = Status
::newGood( 0 );
484 $status->warning( 'undeleterevision-missing' );
489 # Have to create a new article...
492 $previousTimestamp = 0;
496 'ar_namespace' => $this->title
->getNamespace(),
497 'ar_title' => $this->title
->getDBkey(),
499 if ( !$restoreAll ) {
500 $oldWhere['ar_timestamp'] = array_map( array( &$dbw, 'timestamp' ), $timestamps );
519 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
520 $fields[] = 'ar_content_format';
521 $fields[] = 'ar_content_model';
525 * Select each archived revision...
527 $result = $dbw->select( 'archive',
531 /* options */ array( 'ORDER BY' => 'ar_timestamp' )
534 $rev_count = $result->numRows();
536 wfDebug( __METHOD__
. ": no revisions to restore\n" );
538 $status = Status
::newGood( 0 );
539 $status->warning( "undelete-no-results" );
544 $result->seek( $rev_count - 1 ); // move to last
545 $row = $result->fetchObject(); // get newest archived rev
546 $oldPageId = (int)$row->ar_page_id
; // pass this to ArticleUndelete hook
547 $result->seek( 0 ); // move back
549 // grab the content to check consistency with global state before restoring the page.
550 $revision = Revision
::newFromArchiveRow( $row,
552 'title' => $article->getTitle(), // used to derive default content model
555 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
556 $content = $revision->getContent( Revision
::RAW
);
558 // NOTE: article ID may not be known yet. prepareSave() should not modify the database.
559 $status = $content->prepareSave( $article, 0, -1, $user );
561 if ( !$status->isOK() ) {
566 // Check the state of the newest to-be version...
567 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
568 return Status
::newFatal( "undeleterevdel" );
570 // Safe to insert now...
571 $newid = $article->insertOn( $dbw );
574 // Check if a deleted revision will become the current revision...
575 if ( $row->ar_timestamp
> $previousTimestamp ) {
576 // Check the state of the newest to-be version...
577 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
578 return Status
::newFatal( "undeleterevdel" );
583 $pageId = $article->getId();
589 foreach ( $result as $row ) {
590 // Check for key dupes due to needed archive integrity.
591 if ( $row->ar_rev_id
) {
592 $exists = $dbw->selectField( 'revision', '1',
593 array( 'rev_id' => $row->ar_rev_id
), __METHOD__
);
595 continue; // don't throw DB errors
598 // Insert one revision at a time...maintaining deletion status
599 // unless we are specifically removing all restrictions...
600 $revision = Revision
::newFromArchiveRow( $row,
603 'title' => $this->title
,
604 'deleted' => $unsuppress ?
0 : $row->ar_deleted
607 $revision->insertOn( $dbw );
610 Hooks
::run( 'ArticleRevisionUndeleted', array( &$this->title
, $revision, $row->ar_page_id
) );
612 # Now that it's safely stored, take it out of the archive
613 $dbw->delete( 'archive',
617 // Was anything restored at all?
618 if ( $restored == 0 ) {
619 return Status
::newGood( 0 );
622 $created = (bool)$newid;
624 // Attach the latest revision to the page...
625 $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
626 if ( $created ||
$wasnew ) {
627 // Update site stats, link tables, etc
628 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
629 $article->doEditUpdates(
632 array( 'created' => $created, 'oldcountable' => $oldcountable )
636 Hooks
::run( 'ArticleUndelete', array( &$this->title
, $created, $comment, $oldPageId ) );
638 if ( $this->title
->getNamespace() == NS_FILE
) {
639 $update = new HTMLCacheUpdate( $this->title
, 'imagelinks' );
643 return Status
::newGood( $restored );
649 function getFileStatus() {
650 return $this->fileStatus
;
656 function getRevisionStatus() {
657 return $this->revisionStatus
;
662 * Special page allowing users with the appropriate permissions to view
663 * and restore deleted content.
665 * @ingroup SpecialPage
667 class SpecialUndelete
extends SpecialPage
{
674 private $mTargetTimestamp;
683 function __construct() {
684 parent
::__construct( 'Undelete', 'deletedhistory' );
687 function loadRequest( $par ) {
688 $request = $this->getRequest();
689 $user = $this->getUser();
691 $this->mAction
= $request->getVal( 'action' );
692 if ( $par !== null && $par !== '' ) {
693 $this->mTarget
= $par;
695 $this->mTarget
= $request->getVal( 'target' );
698 $this->mTargetObj
= null;
700 if ( $this->mTarget
!== null && $this->mTarget
!== '' ) {
701 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
704 $this->mSearchPrefix
= $request->getText( 'prefix' );
705 $time = $request->getVal( 'timestamp' );
706 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
707 $this->mFilename
= $request->getVal( 'file' );
709 $posted = $request->wasPosted() &&
710 $user->matchEditToken( $request->getVal( 'wpEditToken' ) );
711 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
712 $this->mInvert
= $request->getCheck( 'invert' ) && $posted;
713 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
714 $this->mDiff
= $request->getCheck( 'diff' );
715 $this->mDiffOnly
= $request->getBool( 'diffonly', $this->getUser()->getOption( 'diffonly' ) );
716 $this->mComment
= $request->getText( 'wpComment' );
717 $this->mUnsuppress
= $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' );
718 $this->mToken
= $request->getVal( 'token' );
720 if ( $this->isAllowed( 'undelete' ) && !$user->isBlocked() ) {
721 $this->mAllowed
= true; // user can restore
722 $this->mCanView
= true; // user can view content
723 } elseif ( $this->isAllowed( 'deletedtext' ) ) {
724 $this->mAllowed
= false; // user cannot restore
725 $this->mCanView
= true; // user can view content
726 $this->mRestore
= false;
727 } else { // user can only view the list of revisions
728 $this->mAllowed
= false;
729 $this->mCanView
= false;
730 $this->mTimestamp
= '';
731 $this->mRestore
= false;
734 if ( $this->mRestore ||
$this->mInvert
) {
735 $timestamps = array();
736 $this->mFileVersions
= array();
737 foreach ( $request->getValues() as $key => $val ) {
739 if ( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
740 array_push( $timestamps, $matches[1] );
743 if ( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
744 $this->mFileVersions
[] = intval( $matches[1] );
747 rsort( $timestamps );
748 $this->mTargetTimestamp
= $timestamps;
753 * Checks whether a user is allowed the permission for the
754 * specific title if one is set.
756 * @param string $permission
760 protected function isAllowed( $permission, User
$user = null ) {
761 $user = $user ?
: $this->getUser();
762 if ( $this->mTargetObj
!== null ) {
763 return $this->mTargetObj
->userCan( $permission, $user );
765 return $user->isAllowed( $permission );
769 function userCanExecute( User
$user ) {
770 return $this->isAllowed( $this->mRestriction
, $user );
773 function execute( $par ) {
774 $this->useTransactionalTimeLimit();
776 $user = $this->getUser();
779 $this->outputHeader();
781 $this->loadRequest( $par );
782 $this->checkPermissions(); // Needs to be after mTargetObj is set
784 $out = $this->getOutput();
786 if ( is_null( $this->mTargetObj
) ) {
787 $out->addWikiMsg( 'undelete-header' );
789 # Not all users can just browse every deleted page from the list
790 if ( $user->isAllowed( 'browsearchive' ) ) {
791 $this->showSearchForm();
797 $this->addHelpLink( 'Help:Undelete' );
798 if ( $this->mAllowed
) {
799 $out->setPageTitle( $this->msg( 'undeletepage' ) );
801 $out->setPageTitle( $this->msg( 'viewdeletedpage' ) );
804 $this->getSkin()->setRelevantTitle( $this->mTargetObj
);
806 if ( $this->mTimestamp
!== '' ) {
807 $this->showRevision( $this->mTimestamp
);
808 } elseif ( $this->mFilename
!== null && $this->mTargetObj
->inNamespace( NS_FILE
) ) {
809 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
810 // Check if user is allowed to see this file
811 if ( !$file->exists() ) {
812 $out->addWikiMsg( 'filedelete-nofile', $this->mFilename
);
813 } elseif ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
814 if ( $file->isDeleted( File
::DELETED_RESTRICTED
) ) {
815 throw new PermissionsError( 'suppressrevision' );
817 throw new PermissionsError( 'deletedtext' );
819 } elseif ( !$user->matchEditToken( $this->mToken
, $this->mFilename
) ) {
820 $this->showFileConfirmationForm( $this->mFilename
);
822 $this->showFile( $this->mFilename
);
824 } elseif ( $this->mRestore
&& $this->mAction
== 'submit' ) {
827 $this->showHistory();
831 function showSearchForm() {
832 $out = $this->getOutput();
833 $out->setPageTitle( $this->msg( 'undelete-search-title' ) );
835 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) .
836 Xml
::fieldset( $this->msg( 'undelete-search-box' )->text() ) .
837 Html
::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
840 array( 'for' => 'prefix' ),
841 $this->msg( 'undelete-search-prefix' )->parse()
846 $this->mSearchPrefix
,
847 array( 'id' => 'prefix', 'autofocus' => '' )
849 Xml
::submitButton( $this->msg( 'undelete-search-submit' )->text() ) .
850 Xml
::closeElement( 'fieldset' ) .
851 Xml
::closeElement( 'form' )
854 # List undeletable articles
855 if ( $this->mSearchPrefix
) {
856 $result = PageArchive
::listPagesByPrefix( $this->mSearchPrefix
);
857 $this->showList( $result );
862 * Generic list of deleted pages
864 * @param ResultWrapper $result
867 private function showList( $result ) {
868 $out = $this->getOutput();
870 if ( $result->numRows() == 0 ) {
871 $out->addWikiMsg( 'undelete-no-results' );
876 $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );
878 $undelete = $this->getPageTitle();
879 $out->addHTML( "<ul>\n" );
880 foreach ( $result as $row ) {
881 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
882 if ( $title !== null ) {
883 $item = Linker
::linkKnown(
885 htmlspecialchars( $title->getPrefixedText() ),
887 array( 'target' => $title->getPrefixedText() )
890 // The title is no longer valid, show as text
891 $item = Html
::element(
893 array( 'class' => 'mw-invalidtitle' ),
894 Linker
::getInvalidTitleDescription(
901 $revs = $this->msg( 'undeleterevisions' )->numParams( $row->count
)->parse();
902 $out->addHTML( "<li>{$item} ({$revs})</li>\n" );
905 $out->addHTML( "</ul>\n" );
910 private function showRevision( $timestamp ) {
911 if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
915 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
916 if ( !Hooks
::run( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj
) ) ) {
919 $rev = $archive->getRevision( $timestamp );
921 $out = $this->getOutput();
922 $user = $this->getUser();
925 $out->addWikiMsg( 'undeleterevision-missing' );
930 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
931 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
933 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
934 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
935 'rev-suppressed-text-permission' : 'rev-deleted-text-permission'
942 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
943 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
944 'rev-suppressed-text-view' : 'rev-deleted-text-view'
946 $out->addHTML( '<br />' );
947 // and we are allowed to see...
950 if ( $this->mDiff
) {
951 $previousRev = $archive->getPreviousRevision( $timestamp );
952 if ( $previousRev ) {
953 $this->showDiff( $previousRev, $rev );
954 if ( $this->mDiffOnly
) {
958 $out->addHTML( '<hr />' );
960 $out->addWikiMsg( 'undelete-nodiff' );
964 $link = Linker
::linkKnown(
965 $this->getPageTitle( $this->mTargetObj
->getPrefixedDBkey() ),
966 htmlspecialchars( $this->mTargetObj
->getPrefixedText() )
969 $lang = $this->getLanguage();
971 // date and time are separate parameters to facilitate localisation.
972 // $time is kept for backward compat reasons.
973 $time = $lang->userTimeAndDate( $timestamp, $user );
974 $d = $lang->userDate( $timestamp, $user );
975 $t = $lang->userTime( $timestamp, $user );
976 $userLink = Linker
::revUserTools( $rev );
978 $content = $rev->getContent( Revision
::FOR_THIS_USER
, $user );
980 $isText = ( $content instanceof TextContent
);
982 if ( $this->mPreview ||
$isText ) {
983 $openDiv = '<div id="mw-undelete-revision" class="mw-warning">';
985 $openDiv = '<div id="mw-undelete-revision">';
987 $out->addHTML( $openDiv );
989 // Revision delete links
990 if ( !$this->mDiff
) {
991 $revdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
993 $out->addHTML( "$revdel " );
997 $out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params(
998 $time )->rawParams( $userLink )->params( $d, $t )->parse() . '</div>' );
1000 if ( !Hooks
::run( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) ) ) {
1004 if ( ( $this->mPreview ||
!$isText ) && $content ) {
1005 // NOTE: non-text content has no source view, so always use rendered preview
1008 $popts = $out->parserOptions();
1009 $popts->setEditSection( false );
1011 $pout = $content->getParserOutput( $this->mTargetObj
, $rev->getId(), $popts, true );
1012 $out->addParserOutput( $pout );
1016 // source view for textual content
1017 $sourceView = Xml
::element(
1020 'readonly' => 'readonly',
1021 'cols' => $user->getIntOption( 'cols' ),
1022 'rows' => $user->getIntOption( 'rows' )
1024 $content->getNativeData() . "\n"
1027 $previewButton = Xml
::element( 'input', array(
1029 'name' => 'preview',
1030 'value' => $this->msg( 'showpreview' )->text()
1034 $previewButton = '';
1037 $diffButton = Xml
::element( 'input', array(
1040 'value' => $this->msg( 'showdiff' )->text() ) );
1044 Xml
::openElement( 'div', array(
1045 'style' => 'clear: both' ) ) .
1046 Xml
::openElement( 'form', array(
1048 'action' => $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ) ) ) .
1049 Xml
::element( 'input', array(
1052 'value' => $this->mTargetObj
->getPrefixedDBkey() ) ) .
1053 Xml
::element( 'input', array(
1055 'name' => 'timestamp',
1056 'value' => $timestamp ) ) .
1057 Xml
::element( 'input', array(
1059 'name' => 'wpEditToken',
1060 'value' => $user->getEditToken() ) ) .
1063 Xml
::closeElement( 'form' ) .
1064 Xml
::closeElement( 'div' )
1069 * Build a diff display between this and the previous either deleted
1070 * or non-deleted edit.
1072 * @param Revision $previousRev
1073 * @param Revision $currentRev
1074 * @return string HTML
1076 function showDiff( $previousRev, $currentRev ) {
1077 $diffContext = clone $this->getContext();
1078 $diffContext->setTitle( $currentRev->getTitle() );
1079 $diffContext->setWikiPage( WikiPage
::factory( $currentRev->getTitle() ) );
1081 $diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
1082 $diffEngine->showDiffStyle();
1084 $formattedDiff = $diffEngine->generateContentDiffBody(
1085 $previousRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() ),
1086 $currentRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() )
1089 $formattedDiff = $diffEngine->addHeader(
1091 $this->diffHeader( $previousRev, 'o' ),
1092 $this->diffHeader( $currentRev, 'n' )
1095 $this->getOutput()->addHTML( "<div>$formattedDiff</div>\n" );
1099 * @param Revision $rev
1100 * @param string $prefix
1103 private function diffHeader( $rev, $prefix ) {
1104 $isDeleted = !( $rev->getId() && $rev->getTitle() );
1106 /// @todo FIXME: $rev->getTitle() is null for deleted revs...?
1107 $targetPage = $this->getPageTitle();
1108 $targetQuery = array(
1109 'target' => $this->mTargetObj
->getPrefixedText(),
1110 'timestamp' => wfTimestamp( TS_MW
, $rev->getTimestamp() )
1113 /// @todo FIXME: getId() may return non-zero for deleted revs...
1114 $targetPage = $rev->getTitle();
1115 $targetQuery = array( 'oldid' => $rev->getId() );
1118 // Add show/hide deletion links if available
1119 $user = $this->getUser();
1120 $lang = $this->getLanguage();
1121 $rdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1127 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1129 $tags = wfGetDB( DB_SLAVE
)->selectField(
1132 array( 'ts_rev_id' => $rev->getId() ),
1135 $tagSummary = ChangeTags
::formatSummaryRow( $tags, 'deleteddiff' );
1137 // FIXME This is reimplementing DifferenceEngine#getRevisionHeader
1138 // and partially #showDiffPage, but worse
1139 return '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
1144 $lang->userTimeAndDate( $rev->getTimestamp(), $user ),
1145 $lang->userDate( $rev->getTimestamp(), $user ),
1146 $lang->userTime( $rev->getTimestamp(), $user )
1152 '<div id="mw-diff-' . $prefix . 'title2">' .
1153 Linker
::revUserTools( $rev ) . '<br />' .
1155 '<div id="mw-diff-' . $prefix . 'title3">' .
1156 $minor . Linker
::revComment( $rev ) . $rdel . '<br />' .
1158 '<div id="mw-diff-' . $prefix . 'title5">' .
1159 $tagSummary[0] . '<br />' .
1164 * Show a form confirming whether a tokenless user really wants to see a file
1165 * @param string $key
1167 private function showFileConfirmationForm( $key ) {
1168 $out = $this->getOutput();
1169 $lang = $this->getLanguage();
1170 $user = $this->getUser();
1171 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
1172 $out->addWikiMsg( 'undelete-show-file-confirm',
1173 $this->mTargetObj
->getText(),
1174 $lang->userDate( $file->getTimestamp(), $user ),
1175 $lang->userTime( $file->getTimestamp(), $user ) );
1177 Xml
::openElement( 'form', array(
1179 'action' => $this->getPageTitle()->getLocalURL( array(
1180 'target' => $this->mTarget
,
1182 'token' => $user->getEditToken( $key ),
1186 Xml
::submitButton( $this->msg( 'undelete-show-file-submit' )->text() ) .
1192 * Show a deleted file version requested by the visitor.
1193 * @param string $key
1195 private function showFile( $key ) {
1196 $this->getOutput()->disable();
1198 # We mustn't allow the output to be Squid cached, otherwise
1199 # if an admin previews a deleted image, and it's cached, then
1200 # a user without appropriate permissions can toddle off and
1201 # nab the image, and Squid will serve it
1202 $response = $this->getRequest()->response();
1203 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1204 $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1205 $response->header( 'Pragma: no-cache' );
1207 $repo = RepoGroup
::singleton()->getLocalRepo();
1208 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
1209 $repo->streamFile( $path );
1212 protected function showHistory() {
1213 $this->checkReadOnly();
1215 $out = $this->getOutput();
1216 if ( $this->mAllowed
) {
1217 $out->addModules( 'mediawiki.special.undelete' );
1220 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
1221 array( 'undeletepagetitle', wfEscapeWikiText( $this->mTargetObj
->getPrefixedText() ) )
1224 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1225 Hooks
::run( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj
) );
1227 $text = $archive->getLastRevisionText();
1228 if( is_null( $text ) ) {
1229 $out->addWikiMsg( 'nohistory' );
1233 $out->addHTML( '<div class="mw-undelete-history">' );
1234 if ( $this->mAllowed
) {
1235 $out->addWikiMsg( 'undeletehistory' );
1236 $out->addWikiMsg( 'undeleterevdel' );
1238 $out->addWikiMsg( 'undeletehistorynoadmin' );
1240 $out->addHTML( '</div>' );
1242 # List all stored revisions
1243 $revisions = $archive->listRevisions();
1244 $files = $archive->listFiles();
1246 $haveRevisions = $revisions && $revisions->numRows() > 0;
1247 $haveFiles = $files && $files->numRows() > 0;
1249 # Batch existence check on user and talk pages
1250 if ( $haveRevisions ) {
1251 $batch = new LinkBatch();
1252 foreach ( $revisions as $row ) {
1253 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
1254 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
1257 $revisions->seek( 0 );
1260 $batch = new LinkBatch();
1261 foreach ( $files as $row ) {
1262 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
1263 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
1269 if ( $this->mAllowed
) {
1270 $action = $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) );
1271 # Start the form here
1272 $top = Xml
::openElement(
1274 array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' )
1276 $out->addHTML( $top );
1279 # Show relevant lines from the deletion log:
1280 $deleteLogPage = new LogPage( 'delete' );
1281 $out->addHTML( Xml
::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
1282 LogEventsList
::showLogExtract( $out, 'delete', $this->mTargetObj
);
1283 # Show relevant lines from the suppression log:
1284 $suppressLogPage = new LogPage( 'suppress' );
1285 if ( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
1286 $out->addHTML( Xml
::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
1287 LogEventsList
::showLogExtract( $out, 'suppress', $this->mTargetObj
);
1290 if ( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
1291 # Format the user-visible controls (comment field, submission button)
1292 # in a nice little table
1293 if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
1297 <td class='mw-input'>" .
1298 Xml
::checkLabel( $this->msg( 'revdelete-unsuppress' )->text(),
1299 'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress
) .
1303 $unsuppressBox = '';
1306 $table = Xml
::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
1307 Xml
::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
1309 <td colspan='2' class='mw-undelete-extrahelp'>" .
1310 $this->msg( 'undeleteextrahelp' )->parseAsBlock() .
1314 <td class='mw-label'>" .
1315 Xml
::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
1317 <td class='mw-input'>" .
1322 array( 'id' => 'wpComment', 'autofocus' => '' )
1328 <td class='mw-submit'>" .
1330 $this->msg( 'undeletebtn' )->text(),
1331 array( 'name' => 'restore', 'id' => 'mw-undelete-submit' )
1334 $this->msg( 'undeleteinvert' )->text(),
1335 array( 'name' => 'invert', 'id' => 'mw-undelete-invert' )
1340 Xml
::closeElement( 'table' ) .
1341 Xml
::closeElement( 'fieldset' );
1343 $out->addHTML( $table );
1346 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" );
1348 if ( $haveRevisions ) {
1349 # The page's stored (deleted) history:
1350 $out->addHTML( '<ul>' );
1351 $remaining = $revisions->numRows();
1352 $earliestLiveTime = $this->mTargetObj
->getEarliestRevTime();
1354 foreach ( $revisions as $row ) {
1356 $out->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining ) );
1359 $out->addHTML( '</ul>' );
1361 $out->addWikiMsg( 'nohistory' );
1365 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'filehist' )->text() ) . "\n" );
1366 $out->addHTML( '<ul>' );
1367 foreach ( $files as $row ) {
1368 $out->addHTML( $this->formatFileRow( $row ) );
1371 $out->addHTML( '</ul>' );
1374 if ( $this->mAllowed
) {
1375 # Slip in the hidden controls here
1376 $misc = Html
::hidden( 'target', $this->mTarget
);
1377 $misc .= Html
::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
1378 $misc .= Xml
::closeElement( 'form' );
1379 $out->addHTML( $misc );
1385 protected function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
1386 $rev = Revision
::newFromArchiveRow( $row,
1388 'title' => $this->mTargetObj
1392 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
1393 // Build checkboxen...
1394 if ( $this->mAllowed
) {
1395 if ( $this->mInvert
) {
1396 if ( in_array( $ts, $this->mTargetTimestamp
) ) {
1397 $checkBox = Xml
::check( "ts$ts" );
1399 $checkBox = Xml
::check( "ts$ts", true );
1402 $checkBox = Xml
::check( "ts$ts" );
1408 // Build page & diff links...
1409 $user = $this->getUser();
1410 if ( $this->mCanView
) {
1411 $titleObj = $this->getPageTitle();
1413 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $this->getUser() ) ) {
1414 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1415 $last = $this->msg( 'diff' )->escaped();
1416 } elseif ( $remaining > 0 ||
( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1417 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1418 $last = Linker
::linkKnown(
1420 $this->msg( 'diff' )->escaped(),
1423 'target' => $this->mTargetObj
->getPrefixedText(),
1429 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1430 $last = $this->msg( 'diff' )->escaped();
1433 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1434 $last = $this->msg( 'diff' )->escaped();
1438 $userLink = Linker
::revUserTools( $rev );
1441 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1443 // Revision text size
1444 $size = $row->ar_len
;
1445 if ( !is_null( $size ) ) {
1446 $revTextSize = Linker
::formatRevisionSize( $size );
1450 $comment = Linker
::revComment( $rev );
1454 list( $tagSummary, $classes ) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'deletedhistory' );
1456 $attribs['class'] = implode( ' ', $classes );
1459 // Revision delete links
1460 $revdlink = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1462 $revisionRow = $this->msg( 'undelete-revision-row' )
1476 return Xml
::tags( 'li', $attribs, $revisionRow ) . "\n";
1479 private function formatFileRow( $row ) {
1480 $file = ArchivedFile
::newFromRow( $row );
1481 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
1482 $user = $this->getUser();
1485 if ( $this->mCanView
&& $row->fa_storage_key
) {
1486 if ( $this->mAllowed
) {
1487 $checkBox = Xml
::check( 'fileid' . $row->fa_id
);
1489 $key = urlencode( $row->fa_storage_key
);
1490 $pageLink = $this->getFileLink( $file, $this->getPageTitle(), $ts, $key );
1492 $pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user );
1494 $userLink = $this->getFileUser( $file );
1495 $data = $this->msg( 'widthheight' )->numParams( $row->fa_width
, $row->fa_height
)->text();
1496 $bytes = $this->msg( 'parentheses' )
1497 ->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size
)->text() )
1499 $data = htmlspecialchars( $data . ' ' . $bytes );
1500 $comment = $this->getFileComment( $file );
1502 // Add show/hide deletion links if available
1503 $canHide = $this->isAllowed( 'deleterevision' );
1504 if ( $canHide ||
( $file->getVisibility() && $this->isAllowed( 'deletedhistory' ) ) ) {
1505 if ( !$file->userCan( File
::DELETED_RESTRICTED
, $user ) ) {
1506 // Revision was hidden from sysops
1507 $revdlink = Linker
::revDeleteLinkDisabled( $canHide );
1510 'type' => 'filearchive',
1511 'target' => $this->mTargetObj
->getPrefixedDBkey(),
1512 'ids' => $row->fa_id
1514 $revdlink = Linker
::revDeleteLink( $query,
1515 $file->isDeleted( File
::DELETED_RESTRICTED
), $canHide );
1521 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1525 * Fetch revision text link if it's available to all users
1527 * @param Revision $rev
1528 * @param Title $titleObj
1529 * @param string $ts Timestamp
1532 function getPageLink( $rev, $titleObj, $ts ) {
1533 $user = $this->getUser();
1534 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1536 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
1537 return '<span class="history-deleted">' . $time . '</span>';
1540 $link = Linker
::linkKnown(
1542 htmlspecialchars( $time ),
1545 'target' => $this->mTargetObj
->getPrefixedText(),
1550 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
1551 $link = '<span class="history-deleted">' . $link . '</span>';
1558 * Fetch image view link if it's available to all users
1560 * @param File|ArchivedFile $file
1561 * @param Title $titleObj
1562 * @param string $ts A timestamp
1563 * @param string $key A storage key
1565 * @return string HTML fragment
1567 function getFileLink( $file, $titleObj, $ts, $key ) {
1568 $user = $this->getUser();
1569 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1571 if ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
1572 return '<span class="history-deleted">' . $time . '</span>';
1575 $link = Linker
::linkKnown(
1577 htmlspecialchars( $time ),
1580 'target' => $this->mTargetObj
->getPrefixedText(),
1582 'token' => $user->getEditToken( $key )
1586 if ( $file->isDeleted( File
::DELETED_FILE
) ) {
1587 $link = '<span class="history-deleted">' . $link . '</span>';
1594 * Fetch file's user id if it's available to this user
1596 * @param File|ArchivedFile $file
1597 * @return string HTML fragment
1599 function getFileUser( $file ) {
1600 if ( !$file->userCan( File
::DELETED_USER
, $this->getUser() ) ) {
1601 return '<span class="history-deleted">' .
1602 $this->msg( 'rev-deleted-user' )->escaped() .
1606 $link = Linker
::userLink( $file->getRawUser(), $file->getRawUserText() ) .
1607 Linker
::userToolLinks( $file->getRawUser(), $file->getRawUserText() );
1609 if ( $file->isDeleted( File
::DELETED_USER
) ) {
1610 $link = '<span class="history-deleted">' . $link . '</span>';
1617 * Fetch file upload comment if it's available to this user
1619 * @param File|ArchivedFile $file
1620 * @return string HTML fragment
1622 function getFileComment( $file ) {
1623 if ( !$file->userCan( File
::DELETED_COMMENT
, $this->getUser() ) ) {
1624 return '<span class="history-deleted"><span class="comment">' .
1625 $this->msg( 'rev-deleted-comment' )->escaped() . '</span></span>';
1628 $link = Linker
::commentBlock( $file->getRawDescription() );
1630 if ( $file->isDeleted( File
::DELETED_COMMENT
) ) {
1631 $link = '<span class="history-deleted">' . $link . '</span>';
1637 function undelete() {
1638 if ( $this->getConfig()->get( 'UploadMaintenance' )
1639 && $this->mTargetObj
->getNamespace() == NS_FILE
1641 throw new ErrorPageError( 'undelete-error', 'filedelete-maintenance' );
1644 $this->checkReadOnly();
1646 $out = $this->getOutput();
1647 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1648 Hooks
::run( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj
) );
1649 $ok = $archive->undelete(
1650 $this->mTargetTimestamp
,
1652 $this->mFileVersions
,
1657 if ( is_array( $ok ) ) {
1658 if ( $ok[1] ) { // Undeleted file count
1659 Hooks
::run( 'FileUndeleteComplete', array(
1660 $this->mTargetObj
, $this->mFileVersions
,
1661 $this->getUser(), $this->mComment
) );
1664 $link = Linker
::linkKnown( $this->mTargetObj
);
1665 $out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
1667 $out->setPageTitle( $this->msg( 'undelete-error' ) );
1670 // Show revision undeletion warnings and errors
1671 $status = $archive->getRevisionStatus();
1672 if ( $status && !$status->isGood() ) {
1673 $out->addWikiText( '<div class="error">' .
1674 $status->getWikiText(
1681 // Show file undeletion warnings and errors
1682 $status = $archive->getFileStatus();
1683 if ( $status && !$status->isGood() ) {
1684 $out->addWikiText( '<div class="error">' .
1685 $status->getWikiText(
1686 'undelete-error-short',
1687 'undelete-error-long'
1693 protected function getGroupName() {