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 $img->load( File
::READ_LATEST
);
374 $this->fileStatus
= $img->restore( $fileVersions, $unsuppress );
375 if ( !$this->fileStatus
->isOK() ) {
378 $filesRestored = $this->fileStatus
->successCount
;
383 if ( $restoreText ) {
384 $this->revisionStatus
= $this->undeleteRevisions( $timestamps, $unsuppress, $comment );
385 if ( !$this->revisionStatus
->isOK() ) {
389 $textRestored = $this->revisionStatus
->getValue();
396 if ( $textRestored && $filesRestored ) {
397 $reason = wfMessage( 'undeletedrevisions-files' )
398 ->numParams( $textRestored, $filesRestored )->inContentLanguage()->text();
399 } elseif ( $textRestored ) {
400 $reason = wfMessage( 'undeletedrevisions' )->numParams( $textRestored )
401 ->inContentLanguage()->text();
402 } elseif ( $filesRestored ) {
403 $reason = wfMessage( 'undeletedfiles' )->numParams( $filesRestored )
404 ->inContentLanguage()->text();
406 wfDebug( "Undelete: nothing undeleted...\n" );
411 if ( trim( $comment ) != '' ) {
412 $reason .= wfMessage( 'colon-separator' )->inContentLanguage()->text() . $comment;
415 if ( $user === null ) {
420 $logEntry = new ManualLogEntry( 'delete', 'restore' );
421 $logEntry->setPerformer( $user );
422 $logEntry->setTarget( $this->title
);
423 $logEntry->setComment( $reason );
425 Hooks
::run( 'ArticleUndeleteLogEntry', array( $this, &$logEntry, $user ) );
427 $logid = $logEntry->insert();
428 $logEntry->publish( $logid );
430 return array( $textRestored, $filesRestored, $reason );
434 * This is the meaty bit -- restores archived revisions of the given page
435 * to the cur/old tables. If the page currently exists, all revisions will
436 * be stuffed into old, otherwise the most recent will go into cur.
438 * @param array $timestamps Pass an empty array to restore all revisions,
439 * otherwise list the ones to undelete.
440 * @param bool $unsuppress Remove all ar_deleted/fa_deleted restrictions of seletected revs
441 * @param string $comment
442 * @throws ReadOnlyError
443 * @return Status Status object containing the number of revisions restored on success
445 private function undeleteRevisions( $timestamps, $unsuppress = false, $comment = '' ) {
446 if ( wfReadOnly() ) {
447 throw new ReadOnlyError();
450 $restoreAll = empty( $timestamps );
451 $dbw = wfGetDB( DB_MASTER
);
453 # Does this page already exist? We'll have to update it...
454 $article = WikiPage
::factory( $this->title
);
455 # Load latest data for the current page (bug 31179)
456 $article->loadPageData( 'fromdbmaster' );
457 $oldcountable = $article->isCountable();
459 $page = $dbw->selectRow( 'page',
460 array( 'page_id', 'page_latest' ),
461 array( 'page_namespace' => $this->title
->getNamespace(),
462 'page_title' => $this->title
->getDBkey() ),
464 array( 'FOR UPDATE' ) // lock page
469 # Page already exists. Import the history, and if necessary
470 # we'll update the latest revision field in the record.
472 $previousRevId = $page->page_latest
;
474 # Get the time span of this page
475 $previousTimestamp = $dbw->selectField( 'revision', 'rev_timestamp',
476 array( 'rev_id' => $previousRevId ),
479 if ( $previousTimestamp === false ) {
480 wfDebug( __METHOD__
. ": existing page refers to a page_latest that does not exist\n" );
482 $status = Status
::newGood( 0 );
483 $status->warning( 'undeleterevision-missing' );
488 # Have to create a new article...
491 $previousTimestamp = 0;
495 'ar_namespace' => $this->title
->getNamespace(),
496 'ar_title' => $this->title
->getDBkey(),
498 if ( !$restoreAll ) {
499 $oldWhere['ar_timestamp'] = array_map( array( &$dbw, 'timestamp' ), $timestamps );
518 if ( $this->config
->get( 'ContentHandlerUseDB' ) ) {
519 $fields[] = 'ar_content_format';
520 $fields[] = 'ar_content_model';
524 * Select each archived revision...
526 $result = $dbw->select( 'archive',
530 /* options */ array( 'ORDER BY' => 'ar_timestamp' )
533 $rev_count = $result->numRows();
535 wfDebug( __METHOD__
. ": no revisions to restore\n" );
537 $status = Status
::newGood( 0 );
538 $status->warning( "undelete-no-results" );
543 $result->seek( $rev_count - 1 ); // move to last
544 $row = $result->fetchObject(); // get newest archived rev
545 $oldPageId = (int)$row->ar_page_id
; // pass this to ArticleUndelete hook
546 $result->seek( 0 ); // move back
548 // grab the content to check consistency with global state before restoring the page.
549 $revision = Revision
::newFromArchiveRow( $row,
551 'title' => $article->getTitle(), // used to derive default content model
554 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
555 $content = $revision->getContent( Revision
::RAW
);
557 //NOTE: article ID may not be known yet. prepareSave() should not modify the database.
558 $status = $content->prepareSave( $article, 0, -1, $user );
560 if ( !$status->isOK() ) {
565 // Check the state of the newest to-be version...
566 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
567 return Status
::newFatal( "undeleterevdel" );
569 // Safe to insert now...
570 $newid = $article->insertOn( $dbw );
573 // Check if a deleted revision will become the current revision...
574 if ( $row->ar_timestamp
> $previousTimestamp ) {
575 // Check the state of the newest to-be version...
576 if ( !$unsuppress && ( $row->ar_deleted
& Revision
::DELETED_TEXT
) ) {
577 return Status
::newFatal( "undeleterevdel" );
582 $pageId = $article->getId();
588 foreach ( $result as $row ) {
589 // Check for key dupes due to shitty archive integrity.
590 if ( $row->ar_rev_id
) {
591 $exists = $dbw->selectField( 'revision', '1',
592 array( 'rev_id' => $row->ar_rev_id
), __METHOD__
);
594 continue; // don't throw DB errors
597 // Insert one revision at a time...maintaining deletion status
598 // unless we are specifically removing all restrictions...
599 $revision = Revision
::newFromArchiveRow( $row,
602 'title' => $this->title
,
603 'deleted' => $unsuppress ?
0 : $row->ar_deleted
606 $revision->insertOn( $dbw );
609 Hooks
::run( 'ArticleRevisionUndeleted', array( &$this->title
, $revision, $row->ar_page_id
) );
611 # Now that it's safely stored, take it out of the archive
612 $dbw->delete( 'archive',
616 // Was anything restored at all?
617 if ( $restored == 0 ) {
618 return Status
::newGood( 0 );
621 $created = (bool)$newid;
623 // Attach the latest revision to the page...
624 $wasnew = $article->updateIfNewerOn( $dbw, $revision, $previousRevId );
625 if ( $created ||
$wasnew ) {
626 // Update site stats, link tables, etc
627 $user = User
::newFromName( $revision->getUserText( Revision
::RAW
), false );
628 $article->doEditUpdates(
631 array( 'created' => $created, 'oldcountable' => $oldcountable )
635 Hooks
::run( 'ArticleUndelete', array( &$this->title
, $created, $comment, $oldPageId ) );
637 if ( $this->title
->getNamespace() == NS_FILE
) {
638 $update = new HTMLCacheUpdate( $this->title
, 'imagelinks' );
642 return Status
::newGood( $restored );
648 function getFileStatus() {
649 return $this->fileStatus
;
655 function getRevisionStatus() {
656 return $this->revisionStatus
;
661 * Special page allowing users with the appropriate permissions to view
662 * and restore deleted content.
664 * @ingroup SpecialPage
666 class SpecialUndelete
extends SpecialPage
{
673 private $mTargetTimestamp;
682 function __construct() {
683 parent
::__construct( 'Undelete', 'deletedhistory' );
686 function loadRequest( $par ) {
687 $request = $this->getRequest();
688 $user = $this->getUser();
690 $this->mAction
= $request->getVal( 'action' );
691 if ( $par !== null && $par !== '' ) {
692 $this->mTarget
= $par;
694 $this->mTarget
= $request->getVal( 'target' );
697 $this->mTargetObj
= null;
699 if ( $this->mTarget
!== null && $this->mTarget
!== '' ) {
700 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
703 $this->mSearchPrefix
= $request->getText( 'prefix' );
704 $time = $request->getVal( 'timestamp' );
705 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
706 $this->mFilename
= $request->getVal( 'file' );
708 $posted = $request->wasPosted() &&
709 $user->matchEditToken( $request->getVal( 'wpEditToken' ) );
710 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
711 $this->mInvert
= $request->getCheck( 'invert' ) && $posted;
712 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
713 $this->mDiff
= $request->getCheck( 'diff' );
714 $this->mDiffOnly
= $request->getBool( 'diffonly', $this->getUser()->getOption( 'diffonly' ) );
715 $this->mComment
= $request->getText( 'wpComment' );
716 $this->mUnsuppress
= $request->getVal( 'wpUnsuppress' ) && $user->isAllowed( 'suppressrevision' );
717 $this->mToken
= $request->getVal( 'token' );
719 if ( $this->isAllowed( 'undelete' ) && !$user->isBlocked() ) {
720 $this->mAllowed
= true; // user can restore
721 $this->mCanView
= true; // user can view content
722 } elseif ( $this->isAllowed( 'deletedtext' ) ) {
723 $this->mAllowed
= false; // user cannot restore
724 $this->mCanView
= true; // user can view content
725 $this->mRestore
= false;
726 } else { // user can only view the list of revisions
727 $this->mAllowed
= false;
728 $this->mCanView
= false;
729 $this->mTimestamp
= '';
730 $this->mRestore
= false;
733 if ( $this->mRestore ||
$this->mInvert
) {
734 $timestamps = array();
735 $this->mFileVersions
= array();
736 foreach ( $request->getValues() as $key => $val ) {
738 if ( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
739 array_push( $timestamps, $matches[1] );
742 if ( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
743 $this->mFileVersions
[] = intval( $matches[1] );
746 rsort( $timestamps );
747 $this->mTargetTimestamp
= $timestamps;
752 * Checks whether a user is allowed the permission for the
753 * specific title if one is set.
755 * @param string $permission
759 protected function isAllowed( $permission, User
$user = null ) {
760 $user = $user ?
: $this->getUser();
761 if ( $this->mTargetObj
!== null ) {
762 return $this->mTargetObj
->userCan( $permission, $user );
764 return $user->isAllowed( $permission );
768 function userCanExecute( User
$user ) {
769 return $this->isAllowed( $this->mRestriction
, $user );
772 function execute( $par ) {
773 $user = $this->getUser();
776 $this->outputHeader();
778 $this->loadRequest( $par );
779 $this->checkPermissions(); // Needs to be after mTargetObj is set
781 $out = $this->getOutput();
783 if ( is_null( $this->mTargetObj
) ) {
784 $out->addWikiMsg( 'undelete-header' );
786 # Not all users can just browse every deleted page from the list
787 if ( $user->isAllowed( 'browsearchive' ) ) {
788 $this->showSearchForm();
794 $this->addHelpLink( 'Help:Undelete' );
795 if ( $this->mAllowed
) {
796 $out->setPageTitle( $this->msg( 'undeletepage' ) );
798 $out->setPageTitle( $this->msg( 'viewdeletedpage' ) );
801 $this->getSkin()->setRelevantTitle( $this->mTargetObj
);
803 if ( $this->mTimestamp
!== '' ) {
804 $this->showRevision( $this->mTimestamp
);
805 } elseif ( $this->mFilename
!== null && $this->mTargetObj
->inNamespace( NS_FILE
) ) {
806 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
807 // Check if user is allowed to see this file
808 if ( !$file->exists() ) {
809 $out->addWikiMsg( 'filedelete-nofile', $this->mFilename
);
810 } elseif ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
811 if ( $file->isDeleted( File
::DELETED_RESTRICTED
) ) {
812 throw new PermissionsError( 'suppressrevision' );
814 throw new PermissionsError( 'deletedtext' );
816 } elseif ( !$user->matchEditToken( $this->mToken
, $this->mFilename
) ) {
817 $this->showFileConfirmationForm( $this->mFilename
);
819 $this->showFile( $this->mFilename
);
821 } elseif ( $this->mRestore
&& $this->mAction
== 'submit' ) {
824 $this->showHistory();
828 function showSearchForm() {
829 $out = $this->getOutput();
830 $out->setPageTitle( $this->msg( 'undelete-search-title' ) );
832 Xml
::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) .
833 Xml
::fieldset( $this->msg( 'undelete-search-box' )->text() ) .
834 Html
::hidden( 'title', $this->getPageTitle()->getPrefixedDBkey() ) .
837 array( 'for' => 'prefix' ),
838 $this->msg( 'undelete-search-prefix' )->parse()
843 $this->mSearchPrefix
,
844 array( 'id' => 'prefix', 'autofocus' => '' )
846 Xml
::submitButton( $this->msg( 'undelete-search-submit' )->text() ) .
847 Xml
::closeElement( 'fieldset' ) .
848 Xml
::closeElement( 'form' )
851 # List undeletable articles
852 if ( $this->mSearchPrefix
) {
853 $result = PageArchive
::listPagesByPrefix( $this->mSearchPrefix
);
854 $this->showList( $result );
859 * Generic list of deleted pages
861 * @param ResultWrapper $result
864 private function showList( $result ) {
865 $out = $this->getOutput();
867 if ( $result->numRows() == 0 ) {
868 $out->addWikiMsg( 'undelete-no-results' );
873 $out->addWikiMsg( 'undeletepagetext', $this->getLanguage()->formatNum( $result->numRows() ) );
875 $undelete = $this->getPageTitle();
876 $out->addHTML( "<ul>\n" );
877 foreach ( $result as $row ) {
878 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
879 if ( $title !== null ) {
880 $item = Linker
::linkKnown(
882 htmlspecialchars( $title->getPrefixedText() ),
884 array( 'target' => $title->getPrefixedText() )
887 // The title is no longer valid, show as text
888 $item = Html
::element(
890 array( 'class' => 'mw-invalidtitle' ),
891 Linker
::getInvalidTitleDescription(
898 $revs = $this->msg( 'undeleterevisions' )->numParams( $row->count
)->parse();
899 $out->addHTML( "<li>{$item} ({$revs})</li>\n" );
902 $out->addHTML( "</ul>\n" );
907 private function showRevision( $timestamp ) {
908 if ( !preg_match( '/[0-9]{14}/', $timestamp ) ) {
912 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
913 if ( !Hooks
::run( 'UndeleteForm::showRevision', array( &$archive, $this->mTargetObj
) ) ) {
916 $rev = $archive->getRevision( $timestamp );
918 $out = $this->getOutput();
919 $user = $this->getUser();
922 $out->addWikiMsg( 'undeleterevision-missing' );
927 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
928 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
930 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
931 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
932 'rev-suppressed-text-permission' : 'rev-deleted-text-permission'
939 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
940 $rev->isDeleted( Revision
::DELETED_RESTRICTED
) ?
941 'rev-suppressed-text-view' : 'rev-deleted-text-view'
943 $out->addHTML( '<br />' );
944 // and we are allowed to see...
947 if ( $this->mDiff
) {
948 $previousRev = $archive->getPreviousRevision( $timestamp );
949 if ( $previousRev ) {
950 $this->showDiff( $previousRev, $rev );
951 if ( $this->mDiffOnly
) {
955 $out->addHTML( '<hr />' );
957 $out->addWikiMsg( 'undelete-nodiff' );
961 $link = Linker
::linkKnown(
962 $this->getPageTitle( $this->mTargetObj
->getPrefixedDBkey() ),
963 htmlspecialchars( $this->mTargetObj
->getPrefixedText() )
966 $lang = $this->getLanguage();
968 // date and time are separate parameters to facilitate localisation.
969 // $time is kept for backward compat reasons.
970 $time = $lang->userTimeAndDate( $timestamp, $user );
971 $d = $lang->userDate( $timestamp, $user );
972 $t = $lang->userTime( $timestamp, $user );
973 $userLink = Linker
::revUserTools( $rev );
975 $content = $rev->getContent( Revision
::FOR_THIS_USER
, $user );
977 $isText = ( $content instanceof TextContent
);
979 if ( $this->mPreview ||
$isText ) {
980 $openDiv = '<div id="mw-undelete-revision" class="mw-warning">';
982 $openDiv = '<div id="mw-undelete-revision">';
984 $out->addHTML( $openDiv );
986 // Revision delete links
987 if ( !$this->mDiff
) {
988 $revdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
990 $out->addHTML( "$revdel " );
994 $out->addHTML( $this->msg( 'undelete-revision' )->rawParams( $link )->params(
995 $time )->rawParams( $userLink )->params( $d, $t )->parse() . '</div>' );
997 if ( !Hooks
::run( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) ) ) {
1001 if ( $this->mPreview ||
!$isText ) {
1002 // NOTE: non-text content has no source view, so always use rendered preview
1005 $popts = $out->parserOptions();
1006 $popts->setEditSection( false );
1008 $pout = $content->getParserOutput( $this->mTargetObj
, $rev->getId(), $popts, true );
1009 $out->addParserOutput( $pout );
1013 // source view for textual content
1014 $sourceView = Xml
::element(
1017 'readonly' => 'readonly',
1018 'cols' => $user->getIntOption( 'cols' ),
1019 'rows' => $user->getIntOption( 'rows' )
1021 $content->getNativeData() . "\n"
1024 $previewButton = Xml
::element( 'input', array(
1026 'name' => 'preview',
1027 'value' => $this->msg( 'showpreview' )->text()
1031 $previewButton = '';
1034 $diffButton = Xml
::element( 'input', array(
1037 'value' => $this->msg( 'showdiff' )->text() ) );
1041 Xml
::openElement( 'div', array(
1042 'style' => 'clear: both' ) ) .
1043 Xml
::openElement( 'form', array(
1045 'action' => $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) ) ) ) .
1046 Xml
::element( 'input', array(
1049 'value' => $this->mTargetObj
->getPrefixedDBkey() ) ) .
1050 Xml
::element( 'input', array(
1052 'name' => 'timestamp',
1053 'value' => $timestamp ) ) .
1054 Xml
::element( 'input', array(
1056 'name' => 'wpEditToken',
1057 'value' => $user->getEditToken() ) ) .
1060 Xml
::closeElement( 'form' ) .
1061 Xml
::closeElement( 'div' )
1066 * Build a diff display between this and the previous either deleted
1067 * or non-deleted edit.
1069 * @param Revision $previousRev
1070 * @param Revision $currentRev
1071 * @return string HTML
1073 function showDiff( $previousRev, $currentRev ) {
1074 $diffContext = clone $this->getContext();
1075 $diffContext->setTitle( $currentRev->getTitle() );
1076 $diffContext->setWikiPage( WikiPage
::factory( $currentRev->getTitle() ) );
1078 $diffEngine = $currentRev->getContentHandler()->createDifferenceEngine( $diffContext );
1079 $diffEngine->showDiffStyle();
1081 $formattedDiff = $diffEngine->generateContentDiffBody(
1082 $previousRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() ),
1083 $currentRev->getContent( Revision
::FOR_THIS_USER
, $this->getUser() )
1086 $formattedDiff = $diffEngine->addHeader(
1088 $this->diffHeader( $previousRev, 'o' ),
1089 $this->diffHeader( $currentRev, 'n' )
1092 $this->getOutput()->addHTML( "<div>$formattedDiff</div>\n" );
1096 * @param Revision $rev
1097 * @param string $prefix
1100 private function diffHeader( $rev, $prefix ) {
1101 $isDeleted = !( $rev->getId() && $rev->getTitle() );
1103 /// @todo FIXME: $rev->getTitle() is null for deleted revs...?
1104 $targetPage = $this->getPageTitle();
1105 $targetQuery = array(
1106 'target' => $this->mTargetObj
->getPrefixedText(),
1107 'timestamp' => wfTimestamp( TS_MW
, $rev->getTimestamp() )
1110 /// @todo FIXME: getId() may return non-zero for deleted revs...
1111 $targetPage = $rev->getTitle();
1112 $targetQuery = array( 'oldid' => $rev->getId() );
1115 // Add show/hide deletion links if available
1116 $user = $this->getUser();
1117 $lang = $this->getLanguage();
1118 $rdel = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1124 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1126 $tags = wfGetDB( DB_SLAVE
)->selectField(
1129 array( 'ts_rev_id' => $rev->getId() ),
1132 $tagSummary = ChangeTags
::formatSummaryRow( $tags, 'deleteddiff' );
1134 // FIXME This is reimplementing DifferenceEngine#getRevisionHeader
1135 // and partially #showDiffPage, but worse
1136 return '<div id="mw-diff-' . $prefix . 'title1"><strong>' .
1141 $lang->userTimeAndDate( $rev->getTimestamp(), $user ),
1142 $lang->userDate( $rev->getTimestamp(), $user ),
1143 $lang->userTime( $rev->getTimestamp(), $user )
1149 '<div id="mw-diff-' . $prefix . 'title2">' .
1150 Linker
::revUserTools( $rev ) . '<br />' .
1152 '<div id="mw-diff-' . $prefix . 'title3">' .
1153 $minor . Linker
::revComment( $rev ) . $rdel . '<br />' .
1155 '<div id="mw-diff-' . $prefix . 'title5">' .
1156 $tagSummary[0] . '<br />' .
1161 * Show a form confirming whether a tokenless user really wants to see a file
1162 * @param string $key
1164 private function showFileConfirmationForm( $key ) {
1165 $out = $this->getOutput();
1166 $lang = $this->getLanguage();
1167 $user = $this->getUser();
1168 $file = new ArchivedFile( $this->mTargetObj
, '', $this->mFilename
);
1169 $out->addWikiMsg( 'undelete-show-file-confirm',
1170 $this->mTargetObj
->getText(),
1171 $lang->userDate( $file->getTimestamp(), $user ),
1172 $lang->userTime( $file->getTimestamp(), $user ) );
1174 Xml
::openElement( 'form', array(
1176 'action' => $this->getPageTitle()->getLocalURL( array(
1177 'target' => $this->mTarget
,
1179 'token' => $user->getEditToken( $key ),
1183 Xml
::submitButton( $this->msg( 'undelete-show-file-submit' )->text() ) .
1189 * Show a deleted file version requested by the visitor.
1190 * @param string $key
1192 private function showFile( $key ) {
1193 $this->getOutput()->disable();
1195 # We mustn't allow the output to be Squid cached, otherwise
1196 # if an admin previews a deleted image, and it's cached, then
1197 # a user without appropriate permissions can toddle off and
1198 # nab the image, and Squid will serve it
1199 $response = $this->getRequest()->response();
1200 $response->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
1201 $response->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
1202 $response->header( 'Pragma: no-cache' );
1204 $repo = RepoGroup
::singleton()->getLocalRepo();
1205 $path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
1206 $repo->streamFile( $path );
1209 protected function showHistory() {
1210 $out = $this->getOutput();
1211 if ( $this->mAllowed
) {
1212 $out->addModules( 'mediawiki.special.undelete' );
1215 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
1216 array( 'undeletepagetitle', wfEscapeWikiText( $this->mTargetObj
->getPrefixedText() ) )
1219 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1220 Hooks
::run( 'UndeleteForm::showHistory', array( &$archive, $this->mTargetObj
) );
1222 $text = $archive->getLastRevisionText();
1223 if( is_null( $text ) ) {
1224 $out->addWikiMsg( 'nohistory' );
1228 $out->addHTML( '<div class="mw-undelete-history">' );
1229 if ( $this->mAllowed
) {
1230 $out->addWikiMsg( 'undeletehistory' );
1231 $out->addWikiMsg( 'undeleterevdel' );
1233 $out->addWikiMsg( 'undeletehistorynoadmin' );
1235 $out->addHTML( '</div>' );
1237 # List all stored revisions
1238 $revisions = $archive->listRevisions();
1239 $files = $archive->listFiles();
1241 $haveRevisions = $revisions && $revisions->numRows() > 0;
1242 $haveFiles = $files && $files->numRows() > 0;
1244 # Batch existence check on user and talk pages
1245 if ( $haveRevisions ) {
1246 $batch = new LinkBatch();
1247 foreach ( $revisions as $row ) {
1248 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
1249 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
1252 $revisions->seek( 0 );
1255 $batch = new LinkBatch();
1256 foreach ( $files as $row ) {
1257 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
1258 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
1264 if ( $this->mAllowed
) {
1265 $action = $this->getPageTitle()->getLocalURL( array( 'action' => 'submit' ) );
1266 # Start the form here
1267 $top = Xml
::openElement(
1269 array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' )
1271 $out->addHTML( $top );
1274 # Show relevant lines from the deletion log:
1275 $deleteLogPage = new LogPage( 'delete' );
1276 $out->addHTML( Xml
::element( 'h2', null, $deleteLogPage->getName()->text() ) . "\n" );
1277 LogEventsList
::showLogExtract( $out, 'delete', $this->mTargetObj
);
1278 # Show relevant lines from the suppression log:
1279 $suppressLogPage = new LogPage( 'suppress' );
1280 if ( $this->getUser()->isAllowed( 'suppressionlog' ) ) {
1281 $out->addHTML( Xml
::element( 'h2', null, $suppressLogPage->getName()->text() ) . "\n" );
1282 LogEventsList
::showLogExtract( $out, 'suppress', $this->mTargetObj
);
1285 if ( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
1286 # Format the user-visible controls (comment field, submission button)
1287 # in a nice little table
1288 if ( $this->getUser()->isAllowed( 'suppressrevision' ) ) {
1292 <td class='mw-input'>" .
1293 Xml
::checkLabel( $this->msg( 'revdelete-unsuppress' )->text(),
1294 'wpUnsuppress', 'mw-undelete-unsuppress', $this->mUnsuppress
) .
1298 $unsuppressBox = '';
1301 $table = Xml
::fieldset( $this->msg( 'undelete-fieldset-title' )->text() ) .
1302 Xml
::openElement( 'table', array( 'id' => 'mw-undelete-table' ) ) .
1304 <td colspan='2' class='mw-undelete-extrahelp'>" .
1305 $this->msg( 'undeleteextrahelp' )->parseAsBlock() .
1309 <td class='mw-label'>" .
1310 Xml
::label( $this->msg( 'undeletecomment' )->text(), 'wpComment' ) .
1312 <td class='mw-input'>" .
1317 array( 'id' => 'wpComment', 'autofocus' => '' )
1323 <td class='mw-submit'>" .
1325 $this->msg( 'undeletebtn' )->text(),
1326 array( 'name' => 'restore', 'id' => 'mw-undelete-submit' )
1329 $this->msg( 'undeleteinvert' )->text(),
1330 array( 'name' => 'invert', 'id' => 'mw-undelete-invert' )
1335 Xml
::closeElement( 'table' ) .
1336 Xml
::closeElement( 'fieldset' );
1338 $out->addHTML( $table );
1341 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'history' )->text() ) . "\n" );
1343 if ( $haveRevisions ) {
1344 # The page's stored (deleted) history:
1345 $out->addHTML( '<ul>' );
1346 $remaining = $revisions->numRows();
1347 $earliestLiveTime = $this->mTargetObj
->getEarliestRevTime();
1349 foreach ( $revisions as $row ) {
1351 $out->addHTML( $this->formatRevisionRow( $row, $earliestLiveTime, $remaining ) );
1354 $out->addHTML( '</ul>' );
1356 $out->addWikiMsg( 'nohistory' );
1360 $out->addHTML( Xml
::element( 'h2', null, $this->msg( 'filehist' )->text() ) . "\n" );
1361 $out->addHTML( '<ul>' );
1362 foreach ( $files as $row ) {
1363 $out->addHTML( $this->formatFileRow( $row ) );
1366 $out->addHTML( '</ul>' );
1369 if ( $this->mAllowed
) {
1370 # Slip in the hidden controls here
1371 $misc = Html
::hidden( 'target', $this->mTarget
);
1372 $misc .= Html
::hidden( 'wpEditToken', $this->getUser()->getEditToken() );
1373 $misc .= Xml
::closeElement( 'form' );
1374 $out->addHTML( $misc );
1380 protected function formatRevisionRow( $row, $earliestLiveTime, $remaining ) {
1381 $rev = Revision
::newFromArchiveRow( $row,
1383 'title' => $this->mTargetObj
1387 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
1388 // Build checkboxen...
1389 if ( $this->mAllowed
) {
1390 if ( $this->mInvert
) {
1391 if ( in_array( $ts, $this->mTargetTimestamp
) ) {
1392 $checkBox = Xml
::check( "ts$ts" );
1394 $checkBox = Xml
::check( "ts$ts", true );
1397 $checkBox = Xml
::check( "ts$ts" );
1403 // Build page & diff links...
1404 $user = $this->getUser();
1405 if ( $this->mCanView
) {
1406 $titleObj = $this->getPageTitle();
1408 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $this->getUser() ) ) {
1409 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1410 $last = $this->msg( 'diff' )->escaped();
1411 } elseif ( $remaining > 0 ||
( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1412 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1413 $last = Linker
::linkKnown(
1415 $this->msg( 'diff' )->escaped(),
1418 'target' => $this->mTargetObj
->getPrefixedText(),
1424 $pageLink = $this->getPageLink( $rev, $titleObj, $ts );
1425 $last = $this->msg( 'diff' )->escaped();
1428 $pageLink = htmlspecialchars( $this->getLanguage()->userTimeAndDate( $ts, $user ) );
1429 $last = $this->msg( 'diff' )->escaped();
1433 $userLink = Linker
::revUserTools( $rev );
1436 $minor = $rev->isMinor() ? ChangesList
::flag( 'minor' ) : '';
1438 // Revision text size
1439 $size = $row->ar_len
;
1440 if ( !is_null( $size ) ) {
1441 $revTextSize = Linker
::formatRevisionSize( $size );
1445 $comment = Linker
::revComment( $rev );
1449 list( $tagSummary, $classes ) = ChangeTags
::formatSummaryRow( $row->ts_tags
, 'deletedhistory' );
1451 $attribs['class'] = implode( ' ', $classes );
1454 // Revision delete links
1455 $revdlink = Linker
::getRevDeleteLink( $user, $rev, $this->mTargetObj
);
1457 $revisionRow = $this->msg( 'undelete-revision-row' )
1471 return Xml
::tags( 'li', $attribs, $revisionRow ) . "\n";
1474 private function formatFileRow( $row ) {
1475 $file = ArchivedFile
::newFromRow( $row );
1476 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
1477 $user = $this->getUser();
1480 if ( $this->mCanView
&& $row->fa_storage_key
) {
1481 if ( $this->mAllowed
) {
1482 $checkBox = Xml
::check( 'fileid' . $row->fa_id
);
1484 $key = urlencode( $row->fa_storage_key
);
1485 $pageLink = $this->getFileLink( $file, $this->getPageTitle(), $ts, $key );
1487 $pageLink = $this->getLanguage()->userTimeAndDate( $ts, $user );
1489 $userLink = $this->getFileUser( $file );
1490 $data = $this->msg( 'widthheight' )->numParams( $row->fa_width
, $row->fa_height
)->text();
1491 $bytes = $this->msg( 'parentheses' )
1492 ->rawParams( $this->msg( 'nbytes' )->numParams( $row->fa_size
)->text() )
1494 $data = htmlspecialchars( $data . ' ' . $bytes );
1495 $comment = $this->getFileComment( $file );
1497 // Add show/hide deletion links if available
1498 $canHide = $this->isAllowed( 'deleterevision' );
1499 if ( $canHide ||
( $file->getVisibility() && $this->isAllowed( 'deletedhistory' ) ) ) {
1500 if ( !$file->userCan( File
::DELETED_RESTRICTED
, $user ) ) {
1501 // Revision was hidden from sysops
1502 $revdlink = Linker
::revDeleteLinkDisabled( $canHide );
1505 'type' => 'filearchive',
1506 'target' => $this->mTargetObj
->getPrefixedDBkey(),
1507 'ids' => $row->fa_id
1509 $revdlink = Linker
::revDeleteLink( $query,
1510 $file->isDeleted( File
::DELETED_RESTRICTED
), $canHide );
1516 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1520 * Fetch revision text link if it's available to all users
1522 * @param Revision $rev
1523 * @param Title $titleObj
1524 * @param string $ts Timestamp
1527 function getPageLink( $rev, $titleObj, $ts ) {
1528 $user = $this->getUser();
1529 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1531 if ( !$rev->userCan( Revision
::DELETED_TEXT
, $user ) ) {
1532 return '<span class="history-deleted">' . $time . '</span>';
1535 $link = Linker
::linkKnown(
1537 htmlspecialchars( $time ),
1540 'target' => $this->mTargetObj
->getPrefixedText(),
1545 if ( $rev->isDeleted( Revision
::DELETED_TEXT
) ) {
1546 $link = '<span class="history-deleted">' . $link . '</span>';
1553 * Fetch image view link if it's available to all users
1555 * @param File|ArchivedFile $file
1556 * @param Title $titleObj
1557 * @param string $ts A timestamp
1558 * @param string $key A storage key
1560 * @return string HTML fragment
1562 function getFileLink( $file, $titleObj, $ts, $key ) {
1563 $user = $this->getUser();
1564 $time = $this->getLanguage()->userTimeAndDate( $ts, $user );
1566 if ( !$file->userCan( File
::DELETED_FILE
, $user ) ) {
1567 return '<span class="history-deleted">' . $time . '</span>';
1570 $link = Linker
::linkKnown(
1572 htmlspecialchars( $time ),
1575 'target' => $this->mTargetObj
->getPrefixedText(),
1577 'token' => $user->getEditToken( $key )
1581 if ( $file->isDeleted( File
::DELETED_FILE
) ) {
1582 $link = '<span class="history-deleted">' . $link . '</span>';
1589 * Fetch file's user id if it's available to this user
1591 * @param File|ArchivedFile $file
1592 * @return string HTML fragment
1594 function getFileUser( $file ) {
1595 if ( !$file->userCan( File
::DELETED_USER
, $this->getUser() ) ) {
1596 return '<span class="history-deleted">' .
1597 $this->msg( 'rev-deleted-user' )->escaped() .
1601 $link = Linker
::userLink( $file->getRawUser(), $file->getRawUserText() ) .
1602 Linker
::userToolLinks( $file->getRawUser(), $file->getRawUserText() );
1604 if ( $file->isDeleted( File
::DELETED_USER
) ) {
1605 $link = '<span class="history-deleted">' . $link . '</span>';
1612 * Fetch file upload comment if it's available to this user
1614 * @param File|ArchivedFile $file
1615 * @return string HTML fragment
1617 function getFileComment( $file ) {
1618 if ( !$file->userCan( File
::DELETED_COMMENT
, $this->getUser() ) ) {
1619 return '<span class="history-deleted"><span class="comment">' .
1620 $this->msg( 'rev-deleted-comment' )->escaped() . '</span></span>';
1623 $link = Linker
::commentBlock( $file->getRawDescription() );
1625 if ( $file->isDeleted( File
::DELETED_COMMENT
) ) {
1626 $link = '<span class="history-deleted">' . $link . '</span>';
1632 function undelete() {
1633 if ( $this->getConfig()->get( 'UploadMaintenance' )
1634 && $this->mTargetObj
->getNamespace() == NS_FILE
1636 throw new ErrorPageError( 'undelete-error', 'filedelete-maintenance' );
1639 if ( wfReadOnly() ) {
1640 throw new ReadOnlyError
;
1643 $out = $this->getOutput();
1644 $archive = new PageArchive( $this->mTargetObj
, $this->getConfig() );
1645 Hooks
::run( 'UndeleteForm::undelete', array( &$archive, $this->mTargetObj
) );
1646 $ok = $archive->undelete(
1647 $this->mTargetTimestamp
,
1649 $this->mFileVersions
,
1654 if ( is_array( $ok ) ) {
1655 if ( $ok[1] ) { // Undeleted file count
1656 Hooks
::run( 'FileUndeleteComplete', array(
1657 $this->mTargetObj
, $this->mFileVersions
,
1658 $this->getUser(), $this->mComment
) );
1661 $link = Linker
::linkKnown( $this->mTargetObj
);
1662 $out->addHTML( $this->msg( 'undeletedpage' )->rawParams( $link )->parse() );
1664 $out->setPageTitle( $this->msg( 'undelete-error' ) );
1667 // Show revision undeletion warnings and errors
1668 $status = $archive->getRevisionStatus();
1669 if ( $status && !$status->isGood() ) {
1670 $out->addWikiText( '<div class="error">' .
1671 $status->getWikiText(
1678 // Show file undeletion warnings and errors
1679 $status = $archive->getFileStatus();
1680 if ( $status && !$status->isGood() ) {
1681 $out->addWikiText( '<div class="error">' .
1682 $status->getWikiText(
1683 'undelete-error-short',
1684 'undelete-error-long'
1690 protected function getGroupName() {