4 * Special page allowing users with the appropriate permissions to view
5 * and restore deleted content
8 * @subpackage Special pages
14 function wfSpecialUndelete( $par ) {
17 $form = new UndeleteForm( $wgRequest, $par );
24 * @subpackage SpecialPage
29 function __construct( $title ) {
30 if( is_null( $title ) ) {
31 throw new MWException( 'Archiver() given a null title.');
33 $this->title
= $title;
37 * List all deleted pages recorded in the archive table. Returns result
38 * wrapper with (ar_namespace, ar_title, count) fields, ordered by page
41 * @return ResultWrapper
43 public static function listAllPages() {
44 $dbr = wfGetDB( DB_SLAVE
);
45 return self
::listPages( $dbr, '' );
49 * List deleted pages recorded in the archive table matching the
51 * Returns result wrapper with (ar_namespace, ar_title, count) fields.
53 * @return ResultWrapper
55 public static function listPagesByPrefix( $prefix ) {
56 $dbr = wfGetDB( DB_SLAVE
);
58 $title = Title
::newFromText( $prefix );
60 $ns = $title->getNamespace();
61 $encPrefix = $dbr->escapeLike( $title->getDbKey() );
63 // Prolly won't work too good
64 // @todo handle bare namespace names cleanly?
66 $encPrefix = $dbr->escapeLike( $prefix );
69 'ar_namespace' => $ns,
70 "ar_title LIKE '$encPrefix%'",
72 return self
::listPages( $dbr, $conds );
75 protected static function listPages( $dbr, $condition ) {
76 return $dbr->resultObject(
87 'GROUP BY' => 'ar_namespace,ar_title',
88 'ORDER BY' => 'ar_namespace,ar_title',
96 * List the revisions of the given page. Returns result wrapper with
97 * (ar_minor_edit, ar_timestamp, ar_user, ar_user_text, ar_comment) fields.
99 * @return ResultWrapper
101 function listRevisions() {
102 $dbr = wfGetDB( DB_SLAVE
);
103 $res = $dbr->select( 'archive',
104 array( 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text', 'ar_comment' ),
105 array( 'ar_namespace' => $this->title
->getNamespace(),
106 'ar_title' => $this->title
->getDBkey() ),
107 'PageArchive::listRevisions',
108 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
109 $ret = $dbr->resultObject( $res );
114 * List the deleted file revisions for this page, if it's a file page.
115 * Returns a result wrapper with various filearchive fields, or null
116 * if not a file page.
118 * @return ResultWrapper
119 * @fixme Does this belong in Image for fuller encapsulation?
121 function listFiles() {
122 if( $this->title
->getNamespace() == NS_IMAGE
) {
123 $dbr = wfGetDB( DB_SLAVE
);
124 $res = $dbr->select( 'filearchive',
136 array( 'fa_name' => $this->title
->getDbKey() ),
138 array( 'ORDER BY' => 'fa_timestamp DESC' ) );
139 $ret = $dbr->resultObject( $res );
146 * Fetch (and decompress if necessary) the stored text for the deleted
147 * revision of the page with the given timestamp.
150 * @deprecated Use getRevision() for more flexible information
152 function getRevisionText( $timestamp ) {
153 $rev = $this->getRevision( $timestamp );
154 return $rev ?
$rev->getText() : null;
158 * Return a Revision object containing data for the deleted revision.
159 * Note that the result *may* or *may not* have a null page ID.
160 * @param string $timestamp
163 function getRevision( $timestamp ) {
164 $dbr = wfGetDB( DB_SLAVE
);
165 $row = $dbr->selectRow( 'archive',
176 array( 'ar_namespace' => $this->title
->getNamespace(),
177 'ar_title' => $this->title
->getDbkey(),
178 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
181 return new Revision( array(
182 'page' => $this->title
->getArticleId(),
183 'id' => $row->ar_rev_id
,
184 'text' => ($row->ar_text_id
186 : Revision
::getRevisionText( $row, 'ar_' ) ),
187 'comment' => $row->ar_comment
,
188 'user' => $row->ar_user
,
189 'user_text' => $row->ar_user_text
,
190 'timestamp' => $row->ar_timestamp
,
191 'minor_edit' => $row->ar_minor_edit
,
192 'text_id' => $row->ar_text_id
) );
199 * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
201 function getTextFromRow( $row ) {
202 if( is_null( $row->ar_text_id
) ) {
203 // An old row from MediaWiki 1.4 or previous.
204 // Text is embedded in this row in classic compression format.
205 return Revision
::getRevisionText( $row, "ar_" );
207 // New-style: keyed to the text storage backend.
208 $dbr = wfGetDB( DB_SLAVE
);
209 $text = $dbr->selectRow( 'text',
210 array( 'old_text', 'old_flags' ),
211 array( 'old_id' => $row->ar_text_id
),
213 return Revision
::getRevisionText( $text );
219 * Fetch (and decompress if necessary) the stored text of the most
220 * recently edited deleted revision of the page.
222 * If there are no archived revisions for the page, returns NULL.
226 function getLastRevisionText() {
227 $dbr = wfGetDB( DB_SLAVE
);
228 $row = $dbr->selectRow( 'archive',
229 array( 'ar_text', 'ar_flags', 'ar_text_id' ),
230 array( 'ar_namespace' => $this->title
->getNamespace(),
231 'ar_title' => $this->title
->getDBkey() ),
232 'PageArchive::getLastRevisionText',
233 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
235 return $this->getTextFromRow( $row );
242 * Quick check if any archived revisions are present for the page.
245 function isDeleted() {
246 $dbr = wfGetDB( DB_SLAVE
);
247 $n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
248 array( 'ar_namespace' => $this->title
->getNamespace(),
249 'ar_title' => $this->title
->getDBkey() ) );
254 * Restore the given (or all) text and file revisions for the page.
255 * Once restored, the items will be removed from the archive tables.
256 * The deletion log will be updated with an undeletion notice.
258 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
259 * @param string $comment
260 * @param array $fileVersions
262 * @return true on success.
264 function undelete( $timestamps, $comment = '', $fileVersions = array() ) {
265 // If both the set of text revisions and file revisions are empty,
266 // restore everything. Otherwise, just restore the requested items.
267 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
269 $restoreText = $restoreAll ||
!empty( $timestamps );
270 $restoreFiles = $restoreAll ||
!empty( $fileVersions );
272 if( $restoreFiles && $this->title
->getNamespace() == NS_IMAGE
) {
273 $img = new Image( $this->title
);
274 $filesRestored = $img->restore( $fileVersions );
280 $textRestored = $this->undeleteRevisions( $timestamps );
287 $log = new LogPage( 'delete' );
289 if( $textRestored && $filesRestored ) {
290 $reason = wfMsgForContent( 'undeletedrevisions-files',
291 $wgContLang->formatNum( $textRestored ),
292 $wgContLang->formatNum( $filesRestored ) );
293 } elseif( $textRestored ) {
294 $reason = wfMsgForContent( 'undeletedrevisions',
295 $wgContLang->formatNum( $textRestored ) );
296 } elseif( $filesRestored ) {
297 $reason = wfMsgForContent( 'undeletedfiles',
298 $wgContLang->formatNum( $filesRestored ) );
300 wfDebug( "Undelete: nothing undeleted...\n" );
304 if( trim( $comment ) != '' )
305 $reason .= ": {$comment}";
306 $log->addEntry( 'restore', $this->title
, $reason );
312 * This is the meaty bit -- restores archived revisions of the given page
313 * to the cur/old tables. If the page currently exists, all revisions will
314 * be stuffed into old, otherwise the most recent will go into cur.
316 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
317 * @param string $comment
318 * @param array $fileVersions
320 * @return int number of revisions restored
322 private function undeleteRevisions( $timestamps ) {
325 $restoreAll = empty( $timestamps );
327 $dbw = wfGetDB( DB_MASTER
);
328 $page = $dbw->tableName( 'archive' );
330 # Does this page already exist? We'll have to update it...
331 $article = new Article( $this->title
);
332 $options = ( $wgDBtype == 'postgres' )
333 ?
'' // pg doesn't support this?
335 $page = $dbw->selectRow( 'page',
336 array( 'page_id', 'page_latest' ),
337 array( 'page_namespace' => $this->title
->getNamespace(),
338 'page_title' => $this->title
->getDBkey() ),
342 # Page already exists. Import the history, and if necessary
343 # we'll update the latest revision field in the record.
345 $pageId = $page->page_id
;
346 $previousRevId = $page->page_latest
;
348 # Have to create a new article...
349 $newid = $article->insertOn( $dbw );
355 $oldones = '1 = 1'; # All revisions...
357 $oldts = implode( ',',
358 array_map( array( &$dbw, 'addQuotes' ),
359 array_map( array( &$dbw, 'timestamp' ),
362 $oldones = "ar_timestamp IN ( {$oldts} )";
366 * Restore each revision...
368 $result = $dbw->select( 'archive',
380 'ar_namespace' => $this->title
->getNamespace(),
381 'ar_title' => $this->title
->getDBkey(),
385 'ORDER BY' => 'ar_timestamp' )
387 if( $dbw->numRows( $result ) < count( $timestamps ) ) {
388 wfDebug( __METHOD__
.": couldn't find all requested rows\n" );
395 while( $row = $dbw->fetchObject( $result ) ) {
396 if( $row->ar_text_id
) {
397 // Revision was deleted in 1.5+; text is in
398 // the regular text table, use the reference.
399 // Specify null here so the so the text is
400 // dereferenced for page length info if needed.
403 // Revision was deleted in 1.4 or earlier.
404 // Text is squashed into the archive row, and
405 // a new text table entry will be created for it.
406 $revText = Revision
::getRevisionText( $row, 'ar_' );
408 $revision = new Revision( array(
410 'id' => $row->ar_rev_id
,
412 'comment' => $row->ar_comment
,
413 'user' => $row->ar_user
,
414 'user_text' => $row->ar_user_text
,
415 'timestamp' => $row->ar_timestamp
,
416 'minor_edit' => $row->ar_minor_edit
,
417 'text_id' => $row->ar_text_id
,
419 $revision->insertOn( $dbw );
424 # FIXME: Update latest if newer as well...
426 // Attach the latest revision to the page...
427 $article->updateRevisionOn( $dbw, $revision, $previousRevId );
429 // Update site stats, link tables, etc
430 $article->createUpdates( $revision );
434 wfRunHooks( 'ArticleUndelete', array( &$this->title
, true ) );
435 Article
::onArticleCreate( $this->title
);
437 wfRunHooks( 'ArticleUndelete', array( &$this->title
, false ) );
438 Article
::onArticleEdit( $this->title
);
441 # Something went terribly wrong!
444 # Now that it's safely stored, take it out of the archive
445 $dbw->delete( 'archive',
447 'ar_namespace' => $this->title
->getNamespace(),
448 'ar_title' => $this->title
->getDBkey(),
460 * @subpackage SpecialPage
463 var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
464 var $mTargetTimestamp, $mAllowed, $mComment;
466 function UndeleteForm( $request, $par = "" ) {
468 $this->mAction
= $request->getVal( 'action' );
469 $this->mTarget
= $request->getVal( 'target' );
470 $this->mSearchPrefix
= $request->getText( 'prefix' );
471 $time = $request->getVal( 'timestamp' );
472 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
473 $this->mFile
= $request->getVal( 'file' );
475 $posted = $request->wasPosted() &&
476 $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
477 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
478 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
479 $this->mComment
= $request->getText( 'wpComment' );
482 $this->mTarget
= $par;
484 if ( $wgUser->isAllowed( 'delete' ) && !$wgUser->isBlocked() ) {
485 $this->mAllowed
= true;
487 $this->mAllowed
= false;
488 $this->mTimestamp
= '';
489 $this->mRestore
= false;
491 if ( $this->mTarget
!== "" ) {
492 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
494 $this->mTargetObj
= NULL;
496 if( $this->mRestore
) {
497 $timestamps = array();
498 $this->mFileVersions
= array();
499 foreach( $_REQUEST as $key => $val ) {
501 if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
502 array_push( $timestamps, $matches[1] );
505 if( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
506 $this->mFileVersions
[] = intval( $matches[1] );
509 rsort( $timestamps );
510 $this->mTargetTimestamp
= $timestamps;
516 if ( $this->mAllowed
) {
517 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
519 $wgOut->setPagetitle( wfMsg( "viewdeletedpage" ) );
522 if( is_null( $this->mTargetObj
) ) {
523 $this->showSearchForm();
525 # List undeletable articles
526 if( $this->mSearchPrefix
) {
527 $result = PageArchive
::listPagesByPrefix(
528 $this->mSearchPrefix
);
529 $this->showList( $result );
533 if( $this->mTimestamp
!== '' ) {
534 return $this->showRevision( $this->mTimestamp
);
536 if( $this->mFile
!== null ) {
537 return $this->showFile( $this->mFile
);
539 if( $this->mRestore
&& $this->mAction
== "submit" ) {
540 return $this->undelete();
542 return $this->showHistory();
545 function showSearchForm() {
546 global $wgOut, $wgScript;
547 $wgOut->addWikiText( wfMsg( 'undelete-header' ) );
550 Xml
::openElement( 'form', array(
552 'action' => $wgScript ) ) .
554 Xml
::element( 'legend', array(),
555 wfMsg( 'undelete-search-box' ) ) .
556 Xml
::hidden( 'title',
557 SpecialPage
::getTitleFor( 'Undelete' )->getPrefixedDbKey() ) .
558 Xml
::inputLabel( wfMsg( 'undelete-search-prefix' ),
559 'prefix', 'prefix', 20,
560 $this->mSearchPrefix
) .
561 Xml
::submitButton( wfMsg( 'undelete-search-submit' ) ) .
566 /* private */ function showList( $result ) {
567 global $wgLang, $wgContLang, $wgUser, $wgOut;
569 if( $result->numRows() == 0 ) {
570 $wgOut->addWikiText( wfMsg( 'undelete-no-results' ) );
574 $wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
576 $sk = $wgUser->getSkin();
577 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
578 $wgOut->addHTML( "<ul>\n" );
579 while( $row = $result->fetchObject() ) {
580 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
581 $link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
582 #$revs = wfMsgHtml( 'undeleterevisions', $wgLang->formatNum( $row->count ) );
583 $revs = wfMsgExt( 'undeleterevisions',
584 array( 'parseinline' ),
585 $wgLang->formatNum( $row->count
) );
586 $wgOut->addHtml( "<li>{$link} ({$revs})</li>\n" );
589 $wgOut->addHTML( "</ul>\n" );
594 /* private */ function showRevision( $timestamp ) {
595 global $wgLang, $wgUser, $wgOut;
596 $self = SpecialPage
::getTitleFor( 'Undelete' );
597 $skin = $wgUser->getSkin();
599 if(!preg_match("/[0-9]{14}/",$timestamp)) return 0;
601 $archive = new PageArchive( $this->mTargetObj
);
602 $rev = $archive->getRevision( $timestamp );
604 $wgOut->setPageTitle( wfMsg( 'undeletepage' ) );
605 $link = $skin->makeKnownLinkObj( $self, htmlspecialchars( $this->mTargetObj
->getPrefixedText() ),
606 'target=' . $this->mTargetObj
->getPrefixedUrl() );
607 $wgOut->addHtml( '<p>' . wfMsgHtml( 'undelete-revision', $link,
608 htmlspecialchars( $wgLang->timeAndDate( $timestamp ) ) ) . '</p>' );
611 $wgOut->addWikiText( wfMsg( 'undeleterevision-missing' ) );
615 wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) );
617 if( $this->mPreview
) {
618 $wgOut->addHtml( "<hr />\n" );
619 $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj
, false );
623 wfElement( 'textarea', array(
625 'cols' => intval( $wgUser->getOption( 'cols' ) ),
626 'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
627 $rev->getText() . "\n" ) .
628 wfOpenElement( 'div' ) .
629 wfOpenElement( 'form', array(
631 'action' => $self->getLocalURL( "action=submit" ) ) ) .
632 wfElement( 'input', array(
635 'value' => $this->mTargetObj
->getPrefixedDbKey() ) ) .
636 wfElement( 'input', array(
638 'name' => 'timestamp',
639 'value' => $timestamp ) ) .
640 wfElement( 'input', array(
642 'name' => 'wpEditToken',
643 'value' => $wgUser->editToken() ) ) .
644 wfElement( 'input', array(
648 wfElement( 'input', array(
650 'value' => wfMsg( 'showpreview' ) ) ) .
651 wfCloseElement( 'form' ) .
652 wfCloseElement( 'div' ) );
656 * Show a deleted file version requested by the visitor.
658 function showFile( $key ) {
659 global $wgOut, $wgRequest;
662 # We mustn't allow the output to be Squid cached, otherwise
663 # if an admin previews a deleted image, and it's cached, then
664 # a user without appropriate permissions can toddle off and
665 # nab the image, and Squid will serve it
666 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
667 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
668 $wgRequest->response()->header( 'Pragma: no-cache' );
670 $store = FileStore
::get( 'deleted' );
671 $store->stream( $key );
674 /* private */ function showHistory() {
675 global $wgLang, $wgUser, $wgOut;
677 $sk = $wgUser->getSkin();
678 if ( $this->mAllowed
) {
679 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
681 $wgOut->setPagetitle( wfMsg( 'viewdeletedpage' ) );
684 $archive = new PageArchive( $this->mTargetObj
);
686 $text = $archive->getLastRevisionText();
687 if( is_null( $text ) ) {
688 $wgOut->addWikiText( wfMsg( "nohistory" ) );
692 if ( $this->mAllowed
) {
693 $wgOut->addWikiText( wfMsg( "undeletehistory" ) );
695 $wgOut->addWikiText( wfMsg( "undeletehistorynoadmin" ) );
698 # List all stored revisions
699 $revisions = $archive->listRevisions();
700 $files = $archive->listFiles();
702 $haveRevisions = $revisions && $revisions->numRows() > 0;
703 $haveFiles = $files && $files->numRows() > 0;
705 # Batch existence check on user and talk pages
706 if( $haveRevisions ) {
707 $batch = new LinkBatch();
708 while( $row = $revisions->fetchObject() ) {
709 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
710 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
713 $revisions->seek( 0 );
716 $batch = new LinkBatch();
717 while( $row = $files->fetchObject() ) {
718 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
719 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
725 if ( $this->mAllowed
) {
726 $titleObj = SpecialPage
::getTitleFor( "Undelete" );
727 $action = $titleObj->getLocalURL( "action=submit" );
728 # Start the form here
729 $top = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
730 $wgOut->addHtml( $top );
733 # Show relevant lines from the deletion log:
734 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'delete' ) ) . "</h2>\n" );
735 $logViewer = new LogViewer(
738 array( 'page' => $this->mTargetObj
->getPrefixedText(),
739 'type' => 'delete' ) ) ) );
740 $logViewer->showList( $wgOut );
742 if( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
743 # Format the user-visible controls (comment field, submission button)
744 # in a nice little table
745 $table = '<fieldset><table><tr>';
746 $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>';
747 $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>';
748 $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment
) . '</td>';
749 $table .= '</tr><tr><td> </td><td>';
750 $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) );
751 $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) );
752 $table .= '</td></tr></table></fieldset>';
753 $wgOut->addHtml( $table );
756 $wgOut->addHTML( "<h2>" . htmlspecialchars( wfMsg( "history" ) ) . "</h2>\n" );
758 if( $haveRevisions ) {
759 # The page's stored (deleted) history:
760 $wgOut->addHTML("<ul>");
761 $target = urlencode( $this->mTarget
);
762 while( $row = $revisions->fetchObject() ) {
763 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
764 if ( $this->mAllowed
) {
765 $checkBox = wfCheck( "ts$ts" );
766 $pageLink = $sk->makeKnownLinkObj( $titleObj,
767 $wgLang->timeanddate( $ts, true ),
768 "target=$target×tamp=$ts" );
771 $pageLink = $wgLang->timeanddate( $ts, true );
773 $userLink = $sk->userLink( $row->ar_user
, $row->ar_user_text
) . $sk->userToolLinks( $row->ar_user
, $row->ar_user_text
);
774 $comment = $sk->commentBlock( $row->ar_comment
);
775 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $comment</li>\n" );
779 $wgOut->addHTML("</ul>");
781 $wgOut->addWikiText( wfMsg( "nohistory" ) );
786 $wgOut->addHtml( "<h2>" . wfMsgHtml( 'imghistory' ) . "</h2>\n" );
787 $wgOut->addHtml( "<ul>" );
788 while( $row = $files->fetchObject() ) {
789 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
790 if ( $this->mAllowed
&& $row->fa_storage_key
) {
791 $checkBox = wfCheck( "fileid" . $row->fa_id
);
792 $key = urlencode( $row->fa_storage_key
);
793 $target = urlencode( $this->mTarget
);
794 $pageLink = $sk->makeKnownLinkObj( $titleObj,
795 $wgLang->timeanddate( $ts, true ),
796 "target=$target&file=$key" );
799 $pageLink = $wgLang->timeanddate( $ts, true );
801 $userLink = $sk->userLink( $row->fa_user
, $row->fa_user_text
) . $sk->userToolLinks( $row->fa_user
, $row->fa_user_text
);
803 wfMsgHtml( 'widthheight',
804 $wgLang->formatNum( $row->fa_width
),
805 $wgLang->formatNum( $row->fa_height
) ) .
807 wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size
) ) .
809 $comment = $sk->commentBlock( $row->fa_description
);
810 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
813 $wgOut->addHTML( "</ul>" );
816 if ( $this->mAllowed
) {
817 # Slip in the hidden controls here
818 $misc = wfHidden( 'target', $this->mTarget
);
819 $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() );
820 $wgOut->addHtml( $misc . '</form>' );
826 function undelete() {
827 global $wgOut, $wgUser;
828 if( !is_null( $this->mTargetObj
) ) {
829 $archive = new PageArchive( $this->mTargetObj
);
831 $ok = $archive->undelete(
832 $this->mTargetTimestamp
,
834 $this->mFileVersions
);
837 $skin = $wgUser->getSkin();
838 $link = $skin->makeKnownLinkObj( $this->mTargetObj
);
839 $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
843 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );