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', 'ar_len' ),
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',
175 array( 'ar_namespace' => $this->title
->getNamespace(),
176 'ar_title' => $this->title
->getDbkey(),
177 'ar_timestamp' => $dbr->timestamp( $timestamp ) ),
180 return new Revision( array(
181 'page' => $this->title
->getArticleId(),
182 'id' => $row->ar_rev_id
,
183 'text' => ($row->ar_text_id
185 : Revision
::getRevisionText( $row, 'ar_' ) ),
186 'comment' => $row->ar_comment
,
187 'user' => $row->ar_user
,
188 'user_text' => $row->ar_user_text
,
189 'timestamp' => $row->ar_timestamp
,
190 'minor_edit' => $row->ar_minor_edit
,
191 'text_id' => $row->ar_text_id
) );
198 * Get the text from an archive row containing ar_text, ar_flags and ar_text_id
200 function getTextFromRow( $row ) {
201 if( is_null( $row->ar_text_id
) ) {
202 // An old row from MediaWiki 1.4 or previous.
203 // Text is embedded in this row in classic compression format.
204 return Revision
::getRevisionText( $row, "ar_" );
206 // New-style: keyed to the text storage backend.
207 $dbr = wfGetDB( DB_SLAVE
);
208 $text = $dbr->selectRow( 'text',
209 array( 'old_text', 'old_flags' ),
210 array( 'old_id' => $row->ar_text_id
),
212 return Revision
::getRevisionText( $text );
218 * Fetch (and decompress if necessary) the stored text of the most
219 * recently edited deleted revision of the page.
221 * If there are no archived revisions for the page, returns NULL.
225 function getLastRevisionText() {
226 $dbr = wfGetDB( DB_SLAVE
);
227 $row = $dbr->selectRow( 'archive',
228 array( 'ar_text', 'ar_flags', 'ar_text_id' ),
229 array( 'ar_namespace' => $this->title
->getNamespace(),
230 'ar_title' => $this->title
->getDBkey() ),
231 'PageArchive::getLastRevisionText',
232 array( 'ORDER BY' => 'ar_timestamp DESC' ) );
234 return $this->getTextFromRow( $row );
241 * Quick check if any archived revisions are present for the page.
244 function isDeleted() {
245 $dbr = wfGetDB( DB_SLAVE
);
246 $n = $dbr->selectField( 'archive', 'COUNT(ar_title)',
247 array( 'ar_namespace' => $this->title
->getNamespace(),
248 'ar_title' => $this->title
->getDBkey() ) );
253 * Restore the given (or all) text and file revisions for the page.
254 * Once restored, the items will be removed from the archive tables.
255 * The deletion log will be updated with an undeletion notice.
257 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
258 * @param string $comment
259 * @param array $fileVersions
261 * @return true on success.
263 function undelete( $timestamps, $comment = '', $fileVersions = array() ) {
264 // If both the set of text revisions and file revisions are empty,
265 // restore everything. Otherwise, just restore the requested items.
266 $restoreAll = empty( $timestamps ) && empty( $fileVersions );
268 $restoreText = $restoreAll ||
!empty( $timestamps );
269 $restoreFiles = $restoreAll ||
!empty( $fileVersions );
271 if( $restoreFiles && $this->title
->getNamespace() == NS_IMAGE
) {
272 $img = new Image( $this->title
);
273 $filesRestored = $img->restore( $fileVersions );
279 $textRestored = $this->undeleteRevisions( $timestamps );
286 $log = new LogPage( 'delete' );
288 if( $textRestored && $filesRestored ) {
289 $reason = wfMsgForContent( 'undeletedrevisions-files',
290 $wgContLang->formatNum( $textRestored ),
291 $wgContLang->formatNum( $filesRestored ) );
292 } elseif( $textRestored ) {
293 $reason = wfMsgForContent( 'undeletedrevisions',
294 $wgContLang->formatNum( $textRestored ) );
295 } elseif( $filesRestored ) {
296 $reason = wfMsgForContent( 'undeletedfiles',
297 $wgContLang->formatNum( $filesRestored ) );
299 wfDebug( "Undelete: nothing undeleted...\n" );
303 if( trim( $comment ) != '' )
304 $reason .= ": {$comment}";
305 $log->addEntry( 'restore', $this->title
, $reason );
311 * This is the meaty bit -- restores archived revisions of the given page
312 * to the cur/old tables. If the page currently exists, all revisions will
313 * be stuffed into old, otherwise the most recent will go into cur.
315 * @param array $timestamps Pass an empty array to restore all revisions, otherwise list the ones to undelete.
316 * @param string $comment
317 * @param array $fileVersions
319 * @return int number of revisions restored
321 private function undeleteRevisions( $timestamps ) {
324 $restoreAll = empty( $timestamps );
326 $dbw = wfGetDB( DB_MASTER
);
327 $page = $dbw->tableName( 'archive' );
329 # Does this page already exist? We'll have to update it...
330 $article = new Article( $this->title
);
331 $options = ( $wgDBtype == 'postgres' )
332 ?
'' // pg doesn't support this?
334 $page = $dbw->selectRow( 'page',
335 array( 'page_id', 'page_latest' ),
336 array( 'page_namespace' => $this->title
->getNamespace(),
337 'page_title' => $this->title
->getDBkey() ),
341 # Page already exists. Import the history, and if necessary
342 # we'll update the latest revision field in the record.
344 $pageId = $page->page_id
;
345 $previousRevId = $page->page_latest
;
347 # Have to create a new article...
348 $newid = $article->insertOn( $dbw );
354 $oldones = '1 = 1'; # All revisions...
356 $oldts = implode( ',',
357 array_map( array( &$dbw, 'addQuotes' ),
358 array_map( array( &$dbw, 'timestamp' ),
361 $oldones = "ar_timestamp IN ( {$oldts} )";
365 * Restore each revision...
367 $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
,
418 'len' => $row->ar_len
420 $revision->insertOn( $dbw );
425 # FIXME: Update latest if newer as well...
427 // Attach the latest revision to the page...
428 $article->updateRevisionOn( $dbw, $revision, $previousRevId );
430 // Update site stats, link tables, etc
431 $article->createUpdates( $revision );
435 wfRunHooks( 'ArticleUndelete', array( &$this->title
, true ) );
436 Article
::onArticleCreate( $this->title
);
438 wfRunHooks( 'ArticleUndelete', array( &$this->title
, false ) );
439 Article
::onArticleEdit( $this->title
);
442 # Something went terribly wrong!
445 # Now that it's safely stored, take it out of the archive
446 $dbw->delete( 'archive',
448 'ar_namespace' => $this->title
->getNamespace(),
449 'ar_title' => $this->title
->getDBkey(),
460 * @addtogroup 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
);
775 if (!is_null($size = $row->ar_len
)) {
777 $stxt = wfMsgHtml('historyempty');
779 $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
782 $comment = $sk->commentBlock( $row->ar_comment
);
783 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" );
787 $wgOut->addHTML("</ul>");
789 $wgOut->addWikiText( wfMsg( "nohistory" ) );
794 $wgOut->addHtml( "<h2>" . wfMsgHtml( 'imghistory' ) . "</h2>\n" );
795 $wgOut->addHtml( "<ul>" );
796 while( $row = $files->fetchObject() ) {
797 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
798 if ( $this->mAllowed
&& $row->fa_storage_key
) {
799 $checkBox = wfCheck( "fileid" . $row->fa_id
);
800 $key = urlencode( $row->fa_storage_key
);
801 $target = urlencode( $this->mTarget
);
802 $pageLink = $sk->makeKnownLinkObj( $titleObj,
803 $wgLang->timeanddate( $ts, true ),
804 "target=$target&file=$key" );
807 $pageLink = $wgLang->timeanddate( $ts, true );
809 $userLink = $sk->userLink( $row->fa_user
, $row->fa_user_text
) . $sk->userToolLinks( $row->fa_user
, $row->fa_user_text
);
811 wfMsgHtml( 'widthheight',
812 $wgLang->formatNum( $row->fa_width
),
813 $wgLang->formatNum( $row->fa_height
) ) .
815 wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size
) ) .
817 $comment = $sk->commentBlock( $row->fa_description
);
818 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
821 $wgOut->addHTML( "</ul>" );
824 if ( $this->mAllowed
) {
825 # Slip in the hidden controls here
826 $misc = wfHidden( 'target', $this->mTarget
);
827 $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() );
828 $wgOut->addHtml( $misc . '</form>' );
834 function undelete() {
835 global $wgOut, $wgUser;
836 if( !is_null( $this->mTargetObj
) ) {
837 $archive = new PageArchive( $this->mTargetObj
);
839 $ok = $archive->undelete(
840 $this->mTargetTimestamp
,
842 $this->mFileVersions
);
845 $skin = $wgUser->getSkin();
846 $link = $skin->makeKnownLinkObj( $this->mTargetObj
);
847 $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
851 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );