4 * Special page allowing users with the appropriate permissions to view
5 * and restore deleted content
7 * @addtogroup SpecialPage
13 function wfSpecialUndelete( $par ) {
16 $form = new UndeleteForm( $wgRequest, $par );
21 * @todo document (just needs one-sentence top-level class description)
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 * @todo 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(),
459 * The HTML form for Special:Undelete, which allows users with the appropriate
460 * permissions to view and restore deleted content.
461 * @addtogroup SpecialPage
464 var $mAction, $mTarget, $mTimestamp, $mRestore, $mTargetObj;
465 var $mTargetTimestamp, $mAllowed, $mComment;
467 function UndeleteForm( $request, $par = "" ) {
469 $this->mAction
= $request->getVal( 'action' );
470 $this->mTarget
= $request->getVal( 'target' );
471 $this->mSearchPrefix
= $request->getText( 'prefix' );
472 $time = $request->getVal( 'timestamp' );
473 $this->mTimestamp
= $time ?
wfTimestamp( TS_MW
, $time ) : '';
474 $this->mFile
= $request->getVal( 'file' );
476 $posted = $request->wasPosted() &&
477 $wgUser->matchEditToken( $request->getVal( 'wpEditToken' ) );
478 $this->mRestore
= $request->getCheck( 'restore' ) && $posted;
479 $this->mPreview
= $request->getCheck( 'preview' ) && $posted;
480 $this->mComment
= $request->getText( 'wpComment' );
483 $this->mTarget
= $par;
485 if ( $wgUser->isAllowed( 'delete' ) && !$wgUser->isBlocked() ) {
486 $this->mAllowed
= true;
488 $this->mAllowed
= false;
489 $this->mTimestamp
= '';
490 $this->mRestore
= false;
492 if ( $this->mTarget
!== "" ) {
493 $this->mTargetObj
= Title
::newFromURL( $this->mTarget
);
495 $this->mTargetObj
= NULL;
497 if( $this->mRestore
) {
498 $timestamps = array();
499 $this->mFileVersions
= array();
500 foreach( $_REQUEST as $key => $val ) {
502 if( preg_match( '/^ts(\d{14})$/', $key, $matches ) ) {
503 array_push( $timestamps, $matches[1] );
506 if( preg_match( '/^fileid(\d+)$/', $key, $matches ) ) {
507 $this->mFileVersions
[] = intval( $matches[1] );
510 rsort( $timestamps );
511 $this->mTargetTimestamp
= $timestamps;
517 if ( $this->mAllowed
) {
518 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
520 $wgOut->setPagetitle( wfMsg( "viewdeletedpage" ) );
523 if( is_null( $this->mTargetObj
) ) {
524 $this->showSearchForm();
526 # List undeletable articles
527 if( $this->mSearchPrefix
) {
528 $result = PageArchive
::listPagesByPrefix(
529 $this->mSearchPrefix
);
530 $this->showList( $result );
534 if( $this->mTimestamp
!== '' ) {
535 return $this->showRevision( $this->mTimestamp
);
537 if( $this->mFile
!== null ) {
538 return $this->showFile( $this->mFile
);
540 if( $this->mRestore
&& $this->mAction
== "submit" ) {
541 return $this->undelete();
543 return $this->showHistory();
546 function showSearchForm() {
547 global $wgOut, $wgScript;
548 $wgOut->addWikiText( wfMsg( 'undelete-header' ) );
551 Xml
::openElement( 'form', array(
553 'action' => $wgScript ) ) .
555 Xml
::element( 'legend', array(),
556 wfMsg( 'undelete-search-box' ) ) .
557 Xml
::hidden( 'title',
558 SpecialPage
::getTitleFor( 'Undelete' )->getPrefixedDbKey() ) .
559 Xml
::inputLabel( wfMsg( 'undelete-search-prefix' ),
560 'prefix', 'prefix', 20,
561 $this->mSearchPrefix
) .
562 Xml
::submitButton( wfMsg( 'undelete-search-submit' ) ) .
567 /* private */ function showList( $result ) {
568 global $wgLang, $wgContLang, $wgUser, $wgOut;
570 if( $result->numRows() == 0 ) {
571 $wgOut->addWikiText( wfMsg( 'undelete-no-results' ) );
575 $wgOut->addWikiText( wfMsg( "undeletepagetext" ) );
577 $sk = $wgUser->getSkin();
578 $undelete = SpecialPage
::getTitleFor( 'Undelete' );
579 $wgOut->addHTML( "<ul>\n" );
580 while( $row = $result->fetchObject() ) {
581 $title = Title
::makeTitleSafe( $row->ar_namespace
, $row->ar_title
);
582 $link = $sk->makeKnownLinkObj( $undelete, htmlspecialchars( $title->getPrefixedText() ), 'target=' . $title->getPrefixedUrl() );
583 #$revs = wfMsgHtml( 'undeleterevisions', $wgLang->formatNum( $row->count ) );
584 $revs = wfMsgExt( 'undeleterevisions',
585 array( 'parseinline' ),
586 $wgLang->formatNum( $row->count
) );
587 $wgOut->addHtml( "<li>{$link} ({$revs})</li>\n" );
590 $wgOut->addHTML( "</ul>\n" );
595 /* private */ function showRevision( $timestamp ) {
596 global $wgLang, $wgUser, $wgOut;
597 $self = SpecialPage
::getTitleFor( 'Undelete' );
598 $skin = $wgUser->getSkin();
600 if(!preg_match("/[0-9]{14}/",$timestamp)) return 0;
602 $archive = new PageArchive( $this->mTargetObj
);
603 $rev = $archive->getRevision( $timestamp );
605 $wgOut->setPageTitle( wfMsg( 'undeletepage' ) );
606 $link = $skin->makeKnownLinkObj( $self, htmlspecialchars( $this->mTargetObj
->getPrefixedText() ),
607 'target=' . $this->mTargetObj
->getPrefixedUrl() );
608 $wgOut->addHtml( '<p>' . wfMsgHtml( 'undelete-revision', $link,
609 htmlspecialchars( $wgLang->timeAndDate( $timestamp ) ) ) . '</p>' );
612 $wgOut->addWikiText( wfMsg( 'undeleterevision-missing' ) );
616 wfRunHooks( 'UndeleteShowRevision', array( $this->mTargetObj
, $rev ) );
618 if( $this->mPreview
) {
619 $wgOut->addHtml( "<hr />\n" );
620 $wgOut->addWikiTextTitle( $rev->getText(), $this->mTargetObj
, false );
624 wfElement( 'textarea', array(
626 'cols' => intval( $wgUser->getOption( 'cols' ) ),
627 'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
628 $rev->getText() . "\n" ) .
629 wfOpenElement( 'div' ) .
630 wfOpenElement( 'form', array(
632 'action' => $self->getLocalURL( "action=submit" ) ) ) .
633 wfElement( 'input', array(
636 'value' => $this->mTargetObj
->getPrefixedDbKey() ) ) .
637 wfElement( 'input', array(
639 'name' => 'timestamp',
640 'value' => $timestamp ) ) .
641 wfElement( 'input', array(
643 'name' => 'wpEditToken',
644 'value' => $wgUser->editToken() ) ) .
645 wfElement( 'input', array(
649 wfElement( 'input', array(
651 'value' => wfMsg( 'showpreview' ) ) ) .
652 wfCloseElement( 'form' ) .
653 wfCloseElement( 'div' ) );
657 * Show a deleted file version requested by the visitor.
659 function showFile( $key ) {
660 global $wgOut, $wgRequest;
663 # We mustn't allow the output to be Squid cached, otherwise
664 # if an admin previews a deleted image, and it's cached, then
665 # a user without appropriate permissions can toddle off and
666 # nab the image, and Squid will serve it
667 $wgRequest->response()->header( 'Expires: ' . gmdate( 'D, d M Y H:i:s', 0 ) . ' GMT' );
668 $wgRequest->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
669 $wgRequest->response()->header( 'Pragma: no-cache' );
671 $store = FileStore
::get( 'deleted' );
672 $store->stream( $key );
675 /* private */ function showHistory() {
676 global $wgLang, $wgUser, $wgOut;
678 $sk = $wgUser->getSkin();
679 if ( $this->mAllowed
) {
680 $wgOut->setPagetitle( wfMsg( "undeletepage" ) );
682 $wgOut->setPagetitle( wfMsg( 'viewdeletedpage' ) );
685 $archive = new PageArchive( $this->mTargetObj
);
687 $text = $archive->getLastRevisionText();
688 if( is_null( $text ) ) {
689 $wgOut->addWikiText( wfMsg( "nohistory" ) );
693 if ( $this->mAllowed
) {
694 $wgOut->addWikiText( wfMsg( "undeletehistory" ) );
696 $wgOut->addWikiText( wfMsg( "undeletehistorynoadmin" ) );
699 # List all stored revisions
700 $revisions = $archive->listRevisions();
701 $files = $archive->listFiles();
703 $haveRevisions = $revisions && $revisions->numRows() > 0;
704 $haveFiles = $files && $files->numRows() > 0;
706 # Batch existence check on user and talk pages
707 if( $haveRevisions ) {
708 $batch = new LinkBatch();
709 while( $row = $revisions->fetchObject() ) {
710 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->ar_user_text
) );
711 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->ar_user_text
) );
714 $revisions->seek( 0 );
717 $batch = new LinkBatch();
718 while( $row = $files->fetchObject() ) {
719 $batch->addObj( Title
::makeTitleSafe( NS_USER
, $row->fa_user_text
) );
720 $batch->addObj( Title
::makeTitleSafe( NS_USER_TALK
, $row->fa_user_text
) );
726 if ( $this->mAllowed
) {
727 $titleObj = SpecialPage
::getTitleFor( "Undelete" );
728 $action = $titleObj->getLocalURL( "action=submit" );
729 # Start the form here
730 $top = wfOpenElement( 'form', array( 'method' => 'post', 'action' => $action, 'id' => 'undelete' ) );
731 $wgOut->addHtml( $top );
734 # Show relevant lines from the deletion log:
735 $wgOut->addHTML( "<h2>" . htmlspecialchars( LogPage
::logName( 'delete' ) ) . "</h2>\n" );
736 $logViewer = new LogViewer(
739 array( 'page' => $this->mTargetObj
->getPrefixedText(),
740 'type' => 'delete' ) ) ) );
741 $logViewer->showList( $wgOut );
743 if( $this->mAllowed
&& ( $haveRevisions ||
$haveFiles ) ) {
744 # Format the user-visible controls (comment field, submission button)
745 # in a nice little table
746 $table = '<fieldset><table><tr>';
747 $table .= '<td colspan="2">' . wfMsgWikiHtml( 'undeleteextrahelp' ) . '</td></tr><tr>';
748 $table .= '<td align="right"><strong>' . wfMsgHtml( 'undeletecomment' ) . '</strong></td>';
749 $table .= '<td>' . wfInput( 'wpComment', 50, $this->mComment
) . '</td>';
750 $table .= '</tr><tr><td> </td><td>';
751 $table .= wfSubmitButton( wfMsg( 'undeletebtn' ), array( 'name' => 'restore' ) );
752 $table .= wfElement( 'input', array( 'type' => 'reset', 'value' => wfMsg( 'undeletereset' ) ) );
753 $table .= '</td></tr></table></fieldset>';
754 $wgOut->addHtml( $table );
757 $wgOut->addHTML( "<h2>" . htmlspecialchars( wfMsg( "history" ) ) . "</h2>\n" );
759 if( $haveRevisions ) {
760 # The page's stored (deleted) history:
761 $wgOut->addHTML("<ul>");
762 $target = urlencode( $this->mTarget
);
763 while( $row = $revisions->fetchObject() ) {
764 $ts = wfTimestamp( TS_MW
, $row->ar_timestamp
);
765 if ( $this->mAllowed
) {
766 $checkBox = wfCheck( "ts$ts" );
767 $pageLink = $sk->makeKnownLinkObj( $titleObj,
768 $wgLang->timeanddate( $ts, true ),
769 "target=$target×tamp=$ts" );
772 $pageLink = $wgLang->timeanddate( $ts, true );
774 $userLink = $sk->userLink( $row->ar_user
, $row->ar_user_text
) . $sk->userToolLinks( $row->ar_user
, $row->ar_user_text
);
776 if (!is_null($size = $row->ar_len
)) {
778 $stxt = wfMsgHtml('historyempty');
780 $stxt = wfMsgHtml('historysize', $wgLang->formatNum( $size ) );
783 $comment = $sk->commentBlock( $row->ar_comment
);
784 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $stxt $comment</li>\n" );
788 $wgOut->addHTML("</ul>");
790 $wgOut->addWikiText( wfMsg( "nohistory" ) );
795 $wgOut->addHtml( "<h2>" . wfMsgHtml( 'imghistory' ) . "</h2>\n" );
796 $wgOut->addHtml( "<ul>" );
797 while( $row = $files->fetchObject() ) {
798 $ts = wfTimestamp( TS_MW
, $row->fa_timestamp
);
799 if ( $this->mAllowed
&& $row->fa_storage_key
) {
800 $checkBox = wfCheck( "fileid" . $row->fa_id
);
801 $key = urlencode( $row->fa_storage_key
);
802 $target = urlencode( $this->mTarget
);
803 $pageLink = $sk->makeKnownLinkObj( $titleObj,
804 $wgLang->timeanddate( $ts, true ),
805 "target=$target&file=$key" );
808 $pageLink = $wgLang->timeanddate( $ts, true );
810 $userLink = $sk->userLink( $row->fa_user
, $row->fa_user_text
) . $sk->userToolLinks( $row->fa_user
, $row->fa_user_text
);
812 wfMsgHtml( 'widthheight',
813 $wgLang->formatNum( $row->fa_width
),
814 $wgLang->formatNum( $row->fa_height
) ) .
816 wfMsgHtml( 'nbytes', $wgLang->formatNum( $row->fa_size
) ) .
818 $comment = $sk->commentBlock( $row->fa_description
);
819 $wgOut->addHTML( "<li>$checkBox $pageLink . . $userLink $data $comment</li>\n" );
822 $wgOut->addHTML( "</ul>" );
825 if ( $this->mAllowed
) {
826 # Slip in the hidden controls here
827 $misc = wfHidden( 'target', $this->mTarget
);
828 $misc .= wfHidden( 'wpEditToken', $wgUser->editToken() );
829 $wgOut->addHtml( $misc . '</form>' );
835 function undelete() {
836 global $wgOut, $wgUser;
837 if( !is_null( $this->mTargetObj
) ) {
838 $archive = new PageArchive( $this->mTargetObj
);
840 $ok = $archive->undelete(
841 $this->mTargetTimestamp
,
843 $this->mFileVersions
);
846 $skin = $wgUser->getSkin();
847 $link = $skin->makeKnownLinkObj( $this->mTargetObj
);
848 $wgOut->addHtml( wfMsgWikiHtml( 'undeletedpage', $link ) );
852 $wgOut->showFatalError( wfMsg( "cannotundelete" ) );