4 * Special page allowing users with the appropriate permissions to view
5 * and restore deleted content
7 * @addtogroup Special pages
13 function wfSpecialUndelete( $par ) {
16 $form = new UndeleteForm( $wgRequest, $par );
22 * @addtogroup SpecialPage
27 function __construct( $title ) {
28 if( is_null( $title ) ) {
29 throw new MWException( 'Archiver() given a null title.');
31 $this->title
= $title;
35 * List all deleted pages recorded in the archive table. Returns result
36 * wrapper with (ar_namespace, ar_title, count) fields, ordered by page
39 * @return ResultWrapper
41 public static function listAllPages() {
42 $dbr = wfGetDB( DB_SLAVE
);
43 return self
::listPages( $dbr, '' );
47 * List deleted pages recorded in the archive table matching the
49 * Returns result wrapper with (ar_namespace, ar_title, count) fields.
51 * @return ResultWrapper
53 public static function listPagesByPrefix( $prefix ) {
54 $dbr = wfGetDB( DB_SLAVE
);
56 $title = Title
::newFromText( $prefix );
58 $ns = $title->getNamespace();
59 $encPrefix = $dbr->escapeLike( $title->getDbKey() );
61 // Prolly won't work too good
62 // @todo handle bare namespace names cleanly?
64 $encPrefix = $dbr->escapeLike( $prefix );
67 'ar_namespace' => $ns,
68 "ar_title LIKE '$encPrefix%'",
70 return self
::listPages( $dbr, $conds );
73 protected static function listPages( $dbr, $condition ) {
74 return $dbr->resultObject(
85 'GROUP BY' => 'ar_namespace,ar_title',
86 'ORDER BY' => 'ar_namespace,ar_title',
94 * List the revisions of the given page. Returns result wrapper with
95 * (ar_minor_edit, ar_timestamp, ar_user, ar_user_text, ar_comment) fields.
97 * @return ResultWrapper
99 function listRevisions() {
100 $dbr = wfGetDB( DB_SLAVE
);
101 $res = $dbr->select( 'archive',
102 array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment' ),
103 array( 'ar_namespace' => $this->title
->getNamespace(),
104 'ar_title' => $this->title
->getDBkey() ),
105 'PageArchive::listRevisions',
106 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
107 $ret = $dbr->resultObject( $res );
112 * List the deleted file revisions for this page, if it's a file page.
113 * Returns a result wrapper with various filearchive fields, or null
114 * if not a file page.
116 * @return ResultWrapper
117 * @fixme Does this belong in Image for fuller encapsulation?
119 function listFiles() {
120 if( $this->title
->getNamespace() == NS_IMAGE
) {
121 $dbr = wfGetDB( DB_SLAVE
);
122 $res = $dbr->select( 'filearchive',
134 array( 'fa_name' => $this->title
->getDbKey() ),
136 array( 'ORDER BY' => 'fa_timestamp DESC' ) );
137 $ret = $dbr->resultObject( $res );
144 * Fetch (and decompress if necessary) the stored text for the deleted
145 * revision of the page with the given timestamp.
148 * @deprecated Use getRevision() for more flexible information
150 function getRevisionText( $timestamp ) {
151 $rev = $this->getRevision( $timestamp );
152 return $rev ?
$rev->getText() : null;
156 * Return a Revision object containing data for the deleted revision.
157 * Note that the result *may* or *may not* have a null page ID.
158 * @param string $timestamp
161 function getRevision( $timestamp ) {
162 $dbr = wfGetDB( DB_SLAVE
);
163 $row = $dbr->selectRow( 'archive',
174 array( 'ar_namespace' => $this->title
->getNamespace(),
175 'ar_title' => $this->title
->getDbkey(),
176 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
179 return new Revision( array(
180 'page' => $this->title
->getArticleId(),
181 'id' => $row->ar_rev_id
,
182 'text' => ($row->ar_text_id
184 : Revision
::getRevisionText( $row, 'ar_' ) ),
185 'comment' => $row->ar_comment
,
186 'user' => $row->ar_user
,
187 'user_text' => $row->ar_user_text
,
188 'timestamp' => $row->ar_timestamp
,
189 'minor_edit' => $row->ar_minor_edit
,
190 'text_id' => $row->ar_text_id
) );
197 * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
199 function getTextFromRow( $row ) {
200 if( is_null( $row->ar_text_id
) ) {
201 // An old row from MediaWiki 1.4 or previous.
202 // Text is embedded in this row in classic compression format.
203 return Revision
::getRevisionText( $row, "ar_" );
205 // New-style: keyed to the text storage backend.
206 $dbr = wfGetDB( DB_SLAVE
);
207 $text = $dbr->selectRow( 'text',
208 array( 'old_text', 'old_flags' ),
209 array( 'old_id' => $row->ar_text_id
),
211 return Revision
::getRevisionText( $text );
217 * Fetch (and decompress if necessary) the stored text of the most
218 * recently edited deleted revision of the page.
220 * If there are no archived revisions for the page, returns NULL.
224 function getLastRevisionText() {
225 $dbr = wfGetDB( DB_SLAVE
);
226 $row = $dbr->selectRow( 'archive',
227 array( 'ar_text', 'ar_flags', 'ar_text_id' ),
228 array( 'ar_namespace' => $this->title
->getNamespace(),
229 'ar_title' => $this->title
->getDBkey() ),
230 'PageArchive::getLastRevisionText',
231 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
233 return $this->getTextFromRow( $row );
240 * Quick check if any archived revisions are present for the page.
243 function isDeleted() {
244 $dbr = wfGetDB( DB_SLAVE
);
245 $n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
246 array( 'ar_namespace' => $this->title
->getNamespace(),
247 'ar_title' => $this->title
->getDBkey() ) );
252 * Restore the given (or all) text and file revisions for the page.
253 * Once restored, the items will be removed from the archive tables.
254 * The deletion log will be updated with an undeletion notice.
256 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
257 * @param string $comment
258 * @param array $fileVersions
260 * @return true on success.
262 function undelete( $timestamps, $comment = '', $fileVersions = array() ) {
263 // If both the set of text revisions and file revisions are empty,
264 // restore everything. Otherwise, just restore the requested items.
265 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
267 $restoreText = $restoreAll ||
!empty( $timestamps );
268 $restoreFiles = $restoreAll ||
!empty( $fileVersions );
270 if( $restoreFiles && $this->title
->getNamespace() == NS_IMAGE
) {
271 $img = new Image( $this->title
);
272 $filesRestored = $img->restore( $fileVersions );
278 $textRestored = $this->undeleteRevisions( $timestamps );
285 $log = new LogPage( 'delete' );
287 if( $textRestored && $filesRestored ) {
288 $reason = wfMsgForContent( 'undeletedrevisions-files',
289 $wgContLang->formatNum( $textRestored ),
290 $wgContLang->formatNum( $filesRestored ) );
291 } elseif( $textRestored ) {
292 $reason = wfMsgForContent( 'undeletedrevisions',
293 $wgContLang->formatNum( $textRestored ) );
294 } elseif( $filesRestored ) {
295 $reason = wfMsgForContent( 'undeletedfiles',
296 $wgContLang->formatNum( $filesRestored ) );
298 wfDebug( "Undelete: nothing undeleted...\n" );
302 if( trim( $comment ) != '' )
303 $reason .= ": {$comment}";
304 $log->addEntry( 'restore', $this->title
, $reason );
310 * This is the meaty bit -- restores archived revisions of the given page
311 * to the cur/old tables. If the page currently exists, all revisions will
312 * be stuffed into old, otherwise the most recent will go into cur.
314 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
315 * @param string $comment
316 * @param array $fileVersions
318 * @return int number of revisions restored
320 private function undeleteRevisions( $timestamps ) {
323 $restoreAll = empty( $timestamps );
325 $dbw = wfGetDB( DB_MASTER
);
326 $page = $dbw->tableName( 'archive' );
328 # Does this page already exist? We'll have to update it...
329 $article = new Article( $this->title
);
330 $options = ( $wgDBtype == 'postgres' )
331 ?
'' // pg doesn't support this?
333 $page = $dbw->selectRow( 'page',
334 array( 'page_id', 'page_latest' ),
335 array( 'page_namespace' => $this->title
->getNamespace(),
336 'page_title' => $this->title
->getDBkey() ),
340 # Page already exists. Import the history, and if necessary
341 # we'll update the latest revision field in the record.
343 $pageId = $page->page_id
;
344 $previousRevId = $page->page_latest
;
346 # Have to create a new article...
347 $newid = $article->insertOn( $dbw );
353 $oldones = '1 = 1'; # All revisions...
355 $oldts = implode( ',',
356 array_map( array( &$dbw, 'addQuotes' ),
357 array_map( array( &$dbw, 'timestamp' ),
360 $oldones = "ar_timestamp IN ( {$oldts} )";
364 * Restore each revision...
366 $result = $dbw->select( 'archive',
378 'ar_namespace' => $this->title
->getNamespace(),
379 'ar_title' => $this->title
->getDBkey(),
383 'ORDER BY' => 'ar_timestamp' )
385 if( $dbw->numRows( $result ) < count( $timestamps ) ) {
386 wfDebug( __METHOD__
.": couldn't find all requested rows\n" );
393 while( $row = $dbw->fetchObject( $result ) ) {
394 if( $row->ar_text_id
) {
395 // Revision was deleted in 1.5+; text is in
396 // the regular text table, use the reference.
397 // Specify null here so the so the text is
398 // dereferenced for page length info if needed.
401 // Revision was deleted in 1.4 or earlier.
402 // Text is squashed into the archive row, and
403 // a new text table entry will be created for it.
404 $revText = Revision
::getRevisionText( $row, 'ar_' );
406 $revision = new Revision( array(
408 'id' => $row->ar_rev_id
,
410 'comment' => $row->ar_comment
,
411 'user' => $row->ar_user
,
412 'user_text' => $row->ar_user_text
,
413 'timestamp' => $row->ar_timestamp
,
414 'minor_edit' => $row->ar_minor_edit
,
415 'text_id' => $row->ar_text_id
,
417 $revision->insertOn( $dbw );
422 # FIXME: Update latest if newer as well...
424 // Attach the latest revision to the page...
425 $article->updateRevisionOn( $dbw, $revision, $previousRevId );
427 // Update site stats, link tables, etc
428 $article->createUpdates( $revision );
432 wfRunHooks( 'ArticleUndelete', array( &$this->title
, true ) );
433 Article
::onArticleCreate( $this->title
);
435 wfRunHooks( 'ArticleUndelete', array( &$this->title
, false ) );
436 Article
::onArticleEdit( $this->title
);
439 # Something went terribly wrong!
442 # Now that it's safely stored, take it out of the archive
443 $dbw->delete( 'archive',
445 'ar_namespace' => $this->title
->getNamespace(),
446 'ar_title' => $this->title
->getDBkey(),
457 * @addtogroup SpecialPage
460 var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
461 var $mTargetTimestamp, $mAllowed, $mComment;
463 function UndeleteForm( $request, $par = "" ) {
465 $this->mAction
= $request->getVal( 'action' );
466 $this->mTarget
= $request->getVal( 'target' );
467 $this->mSearchPrefix
= $request->getText( 'prefix' );
468 $time = $request->getVal( 'timestamp' );
469 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
470 $this->mFile
= $request->getVal( 'file' );
472 $posted = $request->wasPosted() &&
473 $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
474 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
475 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
476 $this->mComment
= $request->getText( 'wpComment' );
479 $this->mTarget
= $par;
481 if ( $wgUser->isAllowed( 'delete' ) && !$wgUser->isBlocked() ) {
482 $this->mAllowed
= true;
484 $this->mAllowed
= false;
485 $this->mTimestamp
= '';
486 $this->mRestore
= false;
488 if ( $this->mTarget
!== "" ) {
489 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
491 $this->mTargetObj
= NULL;
493 if( $this->mRestore
) {
494 $timestamps = array();
495 $this->mFileVersions
= array();
496 foreach( $_REQUEST as $key => $val ) {
498 if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
499 array_push( $timestamps, $matches[1] );
502 if( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
503 $this->mFileVersions
[] = intval( $matches[1] );
506 rsort( $timestamps );
507 $this->mTargetTimestamp
= $timestamps;
513 if ( $this->mAllowed
) {
514 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
516 $wgOut->setPagetitle( wfMsg( "viewdeletedpage" ) );
519 if( is_null( $this->mTargetObj
) ) {
520 $this->showSearchForm();
522 # List undeletable articles
523 if( $this->mSearchPrefix
) {
524 $result = PageArchive
::listPagesByPrefix(
525 $this->mSearchPrefix
);
526 $this->showList( $result );
530 if( $this->mTimestamp
!== '' ) {
531 return $this->showRevision( $this->mTimestamp
);
533 if( $this->mFile
!== null ) {
534 return $this->showFile( $this->mFile
);
536 if( $this->mRestore
&& $this->mAction
== "submit" ) {
537 return $this->undelete();
539 return $this->showHistory();
542 function showSearchForm() {
543 global $wgOut, $wgScript;
544 $wgOut->addWikiText( wfMsg( 'undelete-header' ) );
547 Xml
::openElement( 'form', array(
549 'action' => $wgScript ) ) .
551 Xml
::element( 'legend', array(),
552 wfMsg( 'undelete-search-box' ) ) .
553 Xml
::hidden( 'title',
554 SpecialPage
::getTitleFor( 'Undelete' )->getPrefixedDbKey() ) .
555 Xml
::inputLabel( wfMsg( 'undelete-search-prefix' ),
556 'prefix', 'prefix', 20,
557 $this->mSearchPrefix
) .
558 Xml
::submitButton( wfMsg( 'undelete-search-submit' ) ) .
563 /* private */ function showList( $result ) {
564 global $wgLang, $wgContLang, $wgUser, $wgOut;
566 if( $result->numRows() == 0 ) {
567 $wgOut->addWikiText( wfMsg( 'undelete-no-results' ) );
571 $wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
573 $sk = $wgUser->getSkin();
574 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
575 $wgOut->addHTML( "<ul>\n" );
576 while( $row = $result->fetchObject() ) {
577 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
578 $link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
579 #$revs = wfMsgHtml( 'undeleterevisions', $wgLang->formatNum( $row->count ) );
580 $revs = wfMsgExt( 'undeleterevisions',
581 array( 'parseinline' ),
582 $wgLang->formatNum( $row->count
) );
583 $wgOut->addHtml( "<li>{$link} ({$revs})</li>\n" );
586 $wgOut->addHTML( "</ul>\n" );
591 /* private */ function showRevision( $timestamp ) {
592 global $wgLang, $wgUser, $wgOut;
593 $self = SpecialPage
::getTitleFor( 'Undelete' );
594 $skin = $wgUser->getSkin();
596 if(!preg_match("/[0-9]{14}/",$timestamp)) return 0;
598 $archive = new PageArchive( $this->mTargetObj
);
599 $rev = $archive->getRevision( $timestamp );
601 $wgOut->setPageTitle( wfMsg( 'undeletepage' ) );
602 $link = $skin->makeKnownLinkObj( $self, htmlspecialchars( $this->mTargetObj
->getPrefixedText() ),
603 'target=' . $this->mTargetObj
->getPrefixedUrl() );
604 $wgOut->addHtml( '<p>' . wfMsgHtml( 'undelete-revision', $link,
605 htmlspecialchars( $wgLang->timeAndDate( $timestamp ) ) ) . '</p>' );
608 $wgOut->addWikiText( wfMsg( 'undeleterevision-missing' ) );
612 wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) );
614 if( $this->mPreview
) {
615 $wgOut->addHtml( "<hr />\n" );
616 $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj
, false );
620 wfElement( 'textarea', array(
622 'cols' => intval( $wgUser->getOption( 'cols' ) ),
623 'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
624 $rev->getText() . "\n" ) .
625 wfOpenElement( 'div' ) .
626 wfOpenElement( 'form', array(
628 'action' => $self->getLocalURL( "action=submit" ) ) ) .
629 wfElement( 'input', array(
632 'value' => $this->mTargetObj
->getPrefixedDbKey() ) ) .
633 wfElement( 'input', array(
635 'name' => 'timestamp',
636 'value' => $timestamp ) ) .
637 wfElement( 'input', array(
639 'name' => 'wpEditToken',
640 'value' => $wgUser->editToken() ) ) .
641 wfElement( 'input', array(
645 wfElement( 'input', array(
647 'value' => wfMsg( 'showpreview' ) ) ) .
648 wfCloseElement( 'form' ) .
649 wfCloseElement( 'div' ) );
653 * Show a deleted file version requested by the visitor.
655 function showFile( $key ) {
656 global $wgOut, $wgRequest;
659 # We mustn't allow the output to be Squid cached, otherwise
660 # if an admin previews a deleted image, and it's cached, then
661 # a user without appropriate permissions can toddle off and
662 # nab the image, and Squid will serve it
663 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
664 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
665 $wgRequest->response()->header( 'Pragma: no-cache' );
667 $store = FileStore
::get( 'deleted' );
668 $store->stream( $key );
671 /* private */ function showHistory() {
672 global $wgLang, $wgUser, $wgOut;
674 $sk = $wgUser->getSkin();
675 if ( $this->mAllowed
) {
676 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
678 $wgOut->setPagetitle( wfMsg( 'viewdeletedpage' ) );
681 $archive = new PageArchive( $this->mTargetObj
);
683 $text = $archive->getLastRevisionText();
684 if( is_null( $text ) ) {
685 $wgOut->addWikiText( wfMsg( "nohistory" ) );
689 if ( $this->mAllowed
) {
690 $wgOut->addWikiText( wfMsg( "undeletehistory" ) );
692 $wgOut->addWikiText( wfMsg( "undeletehistorynoadmin" ) );
695 # List all stored revisions
696 $revisions = $archive->listRevisions();
697 $files = $archive->listFiles();
699 $haveRevisions = $revisions && $revisions->numRows() > 0;
700 $haveFiles = $files && $files->numRows() > 0;
702 # Batch existence check on user and talk pages
703 if( $haveRevisions ) {
704 $batch = new LinkBatch();
705 while( $row = $revisions->fetchObject() ) {
706 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
707 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
710 $revisions->seek( 0 );
713 $batch = new LinkBatch();
714 while( $row = $files->fetchObject() ) {
715 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
716 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
722 if ( $this->mAllowed
) {
723 $titleObj = SpecialPage
::getTitleFor( "Undelete" );
724 $action = $titleObj->getLocalURL( "action=submit" );
725 # Start the form here
726 $top = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
727 $wgOut->addHtml( $top );
730 # Show relevant lines from the deletion log:
731 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'delete' ) ) . "</h2>\n" );
732 $logViewer = new LogViewer(
735 array( 'page' => $this->mTargetObj
->getPrefixedText(),
736 'type' => 'delete' ) ) ) );
737 $logViewer->showList( $wgOut );
739 if( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
740 # Format the user-visible controls (comment field, submission button)
741 # in a nice little table
742 $table = '<fieldset><table><tr>';
743 $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>';
744 $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>';
745 $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment
) . '</td>';
746 $table .= '</tr><tr><td> </td><td>';
747 $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) );
748 $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) );
749 $table .= '</td></tr></table></fieldset>';
750 $wgOut->addHtml( $table );
753 $wgOut->addHTML( "<h2>" . htmlspecialchars( wfMsg( "history" ) ) . "</h2>\n" );
755 if( $haveRevisions ) {
756 # The page's stored (deleted) history:
757 $wgOut->addHTML("<ul>");
758 $target = urlencode( $this->mTarget
);
759 while( $row = $revisions->fetchObject() ) {
760 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
761 if ( $this->mAllowed
) {
762 $checkBox = wfCheck( "ts$ts" );
763 $pageLink = $sk->makeKnownLinkObj( $titleObj,
764 $wgLang->timeanddate( $ts, true ),
765 "target=$target×tamp=$ts" );
768 $pageLink = $wgLang->timeanddate( $ts, true );
770 $userLink = $sk->userLink( $row->ar_user
, $row->ar_user_text
) . $sk->userToolLinks( $row->ar_user
, $row->ar_user_text
);
771 $comment = $sk->commentBlock( $row->ar_comment
);
772 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
776 $wgOut->addHTML("</ul>");
778 $wgOut->addWikiText( wfMsg( "nohistory" ) );
783 $wgOut->addHtml( "<h2>" . wfMsgHtml( 'imghistory' ) . "</h2>\n" );
784 $wgOut->addHtml( "<ul>" );
785 while( $row = $files->fetchObject() ) {
786 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
787 if ( $this->mAllowed
&& $row->fa_storage_key
) {
788 $checkBox = wfCheck( "fileid" . $row->fa_id
);
789 $key = urlencode( $row->fa_storage_key
);
790 $target = urlencode( $this->mTarget
);
791 $pageLink = $sk->makeKnownLinkObj( $titleObj,
792 $wgLang->timeanddate( $ts, true ),
793 "target=$target&file=$key" );
796 $pageLink = $wgLang->timeanddate( $ts, true );
798 $userLink = $sk->userLink( $row->fa_user
, $row->fa_user_text
) . $sk->userToolLinks( $row->fa_user
, $row->fa_user_text
);
800 wfMsgHtml( 'widthheight',
801 $wgLang->formatNum( $row->fa_width
),
802 $wgLang->formatNum( $row->fa_height
) ) .
804 wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size
) ) .
806 $comment = $sk->commentBlock( $row->fa_description
);
807 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
810 $wgOut->addHTML( "</ul>" );
813 if ( $this->mAllowed
) {
814 # Slip in the hidden controls here
815 $misc = wfHidden( 'target', $this->mTarget
);
816 $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() );
817 $wgOut->addHtml( $misc . '</form>' );
823 function undelete() {
824 global $wgOut, $wgUser;
825 if( !is_null( $this->mTargetObj
) ) {
826 $archive = new PageArchive( $this->mTargetObj
);
828 $ok = $archive->undelete(
829 $this->mTargetTimestamp
,
831 $this->mFileVersions
);
834 $skin = $wgUser->getSkin();
835 $link = $skin->makeKnownLinkObj( $this->mTargetObj
);
836 $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
840 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );