69 parent::__construct(
'Undelete',
'deletedhistory' );
80 $this->mAction = $request->getVal(
'action' );
81 if ( $par !==
null && $par !==
'' ) {
82 $this->mTarget = $par;
84 $this->mTarget = $request->getVal(
'target' );
87 $this->mTargetObj =
null;
89 if ( $this->mTarget !==
null && $this->mTarget !==
'' ) {
90 $this->mTargetObj = Title::newFromText( $this->mTarget );
93 $this->mSearchPrefix = $request->getText(
'prefix' );
94 $time = $request->getVal(
'timestamp' );
95 $this->mTimestamp = $time ?
wfTimestamp( TS_MW, $time ) :
'';
96 $this->mFilename = $request->getVal(
'file' );
98 $posted = $request->wasPosted() &&
99 $user->matchEditToken( $request->getVal(
'wpEditToken' ) );
100 $this->mRestore = $request->getCheck(
'restore' ) && $posted;
101 $this->mRevdel = $request->getCheck(
'revdel' ) && $posted;
102 $this->mInvert = $request->getCheck(
'invert' ) && $posted;
103 $this->mPreview = $request->getCheck(
'preview' ) && $posted;
104 $this->mDiff = $request->getCheck(
'diff' );
105 $this->mDiffOnly = $request->getBool(
'diffonly', $this->
getUser()->getOption(
'diffonly' ) );
106 $this->mComment = $request->getText(
'wpComment' );
107 $this->mUnsuppress = $request->getVal(
'wpUnsuppress' ) && MediaWikiServices::getInstance()
108 ->getPermissionManager()
109 ->userHasRight( $user,
'suppressrevision' );
110 $this->mToken = $request->getVal(
'token' );
113 $this->mAllowed =
true;
114 $this->mCanView =
true;
115 } elseif ( $this->
isAllowed(
'deletedtext' ) ) {
116 $this->mAllowed =
false;
117 $this->mCanView =
true;
118 $this->mRestore =
false;
120 $this->mAllowed =
false;
121 $this->mCanView =
false;
122 $this->mTimestamp =
'';
123 $this->mRestore =
false;
126 if ( $this->mRestore || $this->mInvert ) {
128 $this->mFileVersions = [];
129 foreach ( $request->getValues() as $key => $val ) {
131 if ( preg_match(
'/^ts(\d{14})$/', $key,
$matches ) ) {
132 array_push( $timestamps,
$matches[1] );
135 if ( preg_match(
'/^fileid(\d+)$/', $key,
$matches ) ) {
136 $this->mFileVersions[] = intval(
$matches[1] );
139 rsort( $timestamps );
140 $this->mTargetTimestamp = $timestamps;
153 $user = $user ?: $this->
getUser();
154 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
155 $block = $user->getBlock();
157 if ( $this->mTargetObj !==
null ) {
158 return $permissionManager->userCan( $permission, $user, $this->mTargetObj );
160 $hasRight = $permissionManager->userHasRight( $user, $permission );
161 $sitewideBlock = $block && $block->isSitewide();
162 return $permission ===
'undelete' ? ( $hasRight && !$sitewideBlock ) : $hasRight;
167 return $this->
isAllowed( $this->mRestriction, $user );
178 if ( !parent::userCanExecute( $user ) ) {
185 $this->mTargetObj && MediaWikiServices::getInstance()
187 ->isBlockedFrom( $user, $this->mTargetObj )
205 $this->
addHelpLink(
'Help:Deletion_and_undeletion' );
212 if ( $this->mTargetObj ===
null ) {
213 $out->addWikiMsg(
'undelete-header' );
215 # Not all users can just browse every deleted page from the list
216 if ( MediaWikiServices::getInstance()
218 ->userHasRight( $user,
'browsearchive' )
227 if ( $this->mAllowed ) {
228 $out->setPageTitle( $this->
msg(
'undeletepage' ) );
230 $out->setPageTitle( $this->
msg(
'viewdeletedpage' ) );
233 $this->
getSkin()->setRelevantTitle( $this->mTargetObj );
235 if ( $this->mTimestamp !==
'' ) {
237 } elseif ( $this->mFilename !==
null && $this->mTargetObj->inNamespace(
NS_FILE ) ) {
240 if ( !
$file->exists() ) {
241 $out->addWikiMsg(
'filedelete-nofile', $this->mFilename );
242 } elseif ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
243 if (
$file->isDeleted( File::DELETED_RESTRICTED ) ) {
248 } elseif ( !$user->matchEditToken( $this->mToken, $this->mFilename ) ) {
251 $this->
showFile( $this->mFilename );
253 } elseif ( $this->mAction ===
'submit' ) {
254 if ( $this->mRestore ) {
256 } elseif ( $this->mRevdel ) {
274 foreach ( $this->
getRequest()->getValues() as $key => $val ) {
276 if ( preg_match(
"/^ts(\d{14})$/", $key,
$matches ) ) {
277 $revisionRecord = $archive->getRevisionRecordByTimestamp(
$matches[1] );
278 if ( $revisionRecord ) {
280 $revisions[ $revisionRecord->getId() ] = 1;
286 'type' =>
'revision',
288 'target' => $this->mTargetObj->getPrefixedText()
296 $out->setPageTitle( $this->
msg(
'undelete-search-title' ) );
297 $fuzzySearch = $this->
getRequest()->getVal(
'fuzzy',
true );
302 $fields[] =
new OOUI\ActionFieldLayout(
303 new OOUI\TextInputWidget( [
305 'inputId' =>
'prefix',
307 'value' => $this->mSearchPrefix,
310 new OOUI\ButtonInputWidget( [
311 'label' => $this->
msg(
'undelete-search-submit' )->text(),
312 'flags' => [
'primary',
'progressive' ],
313 'inputId' =>
'searchUndelete',
317 'label' =>
new OOUI\HtmlSnippet(
319 $fuzzySearch ?
'undelete-search-full' :
'undelete-search-prefix'
326 $fieldset =
new OOUI\FieldsetLayout( [
327 'label' => $this->
msg(
'undelete-search-box' )->text(),
331 $form =
new OOUI\FormLayout( [
336 $form->appendContent(
338 new OOUI\HtmlSnippet(
339 Html::hidden(
'title', $this->
getPageTitle()->getPrefixedDBkey() ) .
340 Html::hidden(
'fuzzy', $fuzzySearch )
345 new OOUI\PanelLayout( [
353 # List undeletable articles
354 if ( $this->mSearchPrefix ) {
357 if ( $fuzzySearch ) {
358 $result = PageArchive::listPagesBySearch( $this->mSearchPrefix );
360 $result = PageArchive::listPagesByPrefix( $this->mSearchPrefix );
375 if ( $result->numRows() == 0 ) {
376 $out->addWikiMsg(
'undelete-no-results' );
381 $out->addWikiMsg(
'undeletepagetext', $this->
getLanguage()->formatNum( $result->numRows() ) );
385 $out->addHTML(
"<ul id='undeleteResultsList'>\n" );
386 foreach ( $result as $row ) {
387 $title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
391 $title->getPrefixedText(),
393 [
'target' =>
$title->getPrefixedText() ]
397 $item = Html::element(
399 [
'class' =>
'mw-invalidtitle' ],
407 $revs = $this->
msg(
'undeleterevisions' )->numParams( $row->count )->parse();
411 [
'class' =>
'undeleteResult' ],
417 $out->addHTML(
"</ul>\n" );
423 if ( !preg_match(
'/[0-9]{14}/', $timestamp ) ) {
429 $archive, $this->mTargetObj )
433 $revRecord = $archive->getRevisionRecordByTimestamp( $timestamp );
439 $out->addWikiMsg(
'undeleterevision-missing' );
444 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
445 if ( !RevisionRecord::userCanBitfield(
446 $revRecord->getVisibility(),
447 RevisionRecord::DELETED_TEXT,
451 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
452 $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ?
453 'rev-suppressed-text-permission' :
'rev-deleted-text-permission'
460 "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
461 $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED ) ?
462 'rev-suppressed-text-view' :
'rev-deleted-text-view'
464 $out->addHTML(
'<br />' );
468 if ( $this->mDiff ) {
469 $previousRevRecord = $archive->getPreviousRevisionRecord( $timestamp );
470 if ( $previousRevRecord ) {
471 $this->
showDiff( $previousRevRecord, $revRecord );
472 if ( $this->mDiffOnly ) {
476 $out->addHTML(
'<hr />' );
478 $out->addWikiMsg(
'undelete-nodiff' );
483 $this->
getPageTitle( $this->mTargetObj->getPrefixedDBkey() ),
484 $this->mTargetObj->getPrefixedText()
491 $time =
$lang->userTimeAndDate( $timestamp, $user );
492 $d =
$lang->userDate( $timestamp, $user );
493 $t =
$lang->userTime( $timestamp, $user );
498 RevisionRecord::FOR_THIS_USER,
505 if ( $this->mPreview || $isText ) {
506 $openDiv =
'<div id="mw-undelete-revision" class="mw-warning">';
508 $openDiv =
'<div id="mw-undelete-revision">';
510 $out->addHTML( $openDiv );
513 if ( !$this->mDiff ) {
520 $out->addHTML(
"$revdel " );
529 $out->addHTML(
'</div>' );
543 if ( $this->mPreview || !$isText ) {
546 $popts = $out->parserOptions();
547 $renderer = MediaWikiServices::getInstance()->getRevisionRenderer();
549 $rendered = $renderer->getRenderedRevision(
553 [
'audience' => RevisionRecord::FOR_THIS_USER ]
558 $pout = $rendered->getRevisionParserOutput();
560 $out->addParserOutput( $pout, [
561 'enableSectionEditLinks' =>
false,
569 '@phan-var TextContent $content';
572 $sourceView = Xml::element(
'textarea', [
573 'readonly' =>
'readonly',
578 $buttonFields[] =
new OOUI\ButtonInputWidget( [
581 'label' => $this->
msg(
'showpreview' )->text()
587 $buttonFields[] =
new OOUI\ButtonInputWidget( [
590 'label' => $this->
msg(
'showdiff' )->text()
595 Xml::openElement(
'div', [
596 'style' =>
'clear: both' ] ) .
597 Xml::openElement(
'form', [
599 'action' => $this->
getPageTitle()->getLocalURL( [
'action' =>
'submit' ] ) ] ) .
600 Xml::element(
'input', [
603 'value' => $this->mTargetObj->getPrefixedDBkey() ] ) .
604 Xml::element(
'input', [
606 'name' =>
'timestamp',
607 'value' => $timestamp ] ) .
608 Xml::element(
'input', [
610 'name' =>
'wpEditToken',
611 'value' => $user->getEditToken() ] ) .
612 new OOUI\FieldLayout(
614 'content' =>
new OOUI\HorizontalLayout( [
615 'items' => $buttonFields
619 Xml::closeElement(
'form' ) .
620 Xml::closeElement(
'div' )
638 $diffContext->setTitle( $currentTitle );
639 $diffContext->setWikiPage( WikiPage::factory( $currentTitle ) );
641 $contentModel = $currentRevRecord->
getSlot(
646 $diffEngine = MediaWikiServices::getInstance()
647 ->getContentHandlerFactory()
648 ->getContentHandler( $contentModel )
649 ->createDifferenceEngine( $diffContext );
651 $diffEngine->setRevisions( $previousRevRecord, $currentRevRecord );
652 $diffEngine->showDiffStyle();
653 $formattedDiff = $diffEngine->getDiff(
658 $this->
getOutput()->addHTML(
"<div>$formattedDiff</div>\n" );
672 'target' => $this->mTargetObj->getPrefixedText(),
678 $targetQuery = [
'oldid' => $revRecord->
getId() ];
690 $minor = $revRecord->
isMinor() ? ChangesList::flag(
'minor' ) :
'';
695 [
'ct_rev_id' => $revRecord->
getId() ],
699 $changeTagDefStore = MediaWikiServices::getInstance()->getChangeTagDefStore();
700 foreach ( $tagIds as $tagId ) {
702 $tags[] = $changeTagDefStore->getName( (
int)$tagId );
707 $tags = implode(
',', $tags );
712 return '<div id="mw-diff-' . $prefix .
'title1"><strong>' .
725 '<div id="mw-diff-' . $prefix .
'title2">' .
728 '<div id="mw-diff-' . $prefix .
'title3">' .
731 '<div id="mw-diff-' . $prefix .
'title5">' .
732 $tagSummary[0] .
'<br />' .
745 $out->addWikiMsg(
'undelete-show-file-confirm',
746 $this->mTargetObj->getText(),
747 $lang->userDate(
$file->getTimestamp(), $user ),
748 $lang->userTime(
$file->getTimestamp(), $user ) );
750 Xml::openElement(
'form', [
753 'target' => $this->mTarget,
755 'token' => $user->getEditToken( $key ),
759 Xml::submitButton( $this->msg(
'undelete-show-file-submit' )->text() ) .
771 # We mustn't allow the output to be CDN cached, otherwise
772 # if an admin previews a deleted image, and it's cached, then
773 # a user without appropriate permissions can toddle off and
774 # nab the image, and CDN will serve it
776 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
777 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
778 $response->header(
'Pragma: no-cache' );
780 $repo = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo();
781 $path = $repo->getZonePath(
'deleted' ) .
'/' . $repo->getDeletedHashPath( $key ) . $key;
782 $repo->streamFileWithStatus(
$path );
789 if ( $this->mAllowed ) {
790 $out->addModules(
'mediawiki.special.undelete' );
793 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
794 [
'undeletepagetitle',
wfEscapeWikiText( $this->mTargetObj->getPrefixedText() ) ]
798 $this->
getHookRunner()->onUndeleteForm__showHistory( $archive, $this->mTargetObj );
800 $out->addHTML(
'<div class="mw-undelete-history">' );
801 if ( $this->mAllowed ) {
802 $out->addWikiMsg(
'undeletehistory' );
803 $out->addWikiMsg(
'undeleterevdel' );
805 $out->addWikiMsg(
'undeletehistorynoadmin' );
807 $out->addHTML(
'</div>' );
809 # List all stored revisions
810 $revisions = $archive->listRevisions();
811 $files = $archive->listFiles();
813 $haveRevisions = $revisions && $revisions->numRows() > 0;
814 $haveFiles = $files && $files->numRows() > 0;
816 # Batch existence check on user and talk pages
817 if ( $haveRevisions ) {
819 foreach ( $revisions as $row ) {
820 $batch->addObj( Title::makeTitleSafe(
NS_USER, $row->ar_user_text ) );
821 $batch->addObj( Title::makeTitleSafe(
NS_USER_TALK, $row->ar_user_text ) );
824 $revisions->seek( 0 );
828 foreach ( $files as $row ) {
829 $batch->addObj( Title::makeTitleSafe(
NS_USER, $row->fa_user_text ) );
830 $batch->addObj( Title::makeTitleSafe(
NS_USER_TALK, $row->fa_user_text ) );
836 if ( $this->mAllowed ) {
839 $action = $this->
getPageTitle()->getLocalURL( [
'action' =>
'submit' ] );
840 # Start the form here
841 $form =
new OOUI\FormLayout( [
848 # Show relevant lines from the deletion log:
849 $deleteLogPage =
new LogPage(
'delete' );
850 $out->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) .
"\n" );
851 LogEventsList::showLogExtract( $out,
'delete', $this->mTargetObj );
852 # Show relevant lines from the suppression log:
853 $suppressLogPage =
new LogPage(
'suppress' );
854 $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
855 if ( $permissionManager->userHasRight( $this->getUser(),
'suppressionlog' ) ) {
856 $out->addHTML( Xml::element(
'h2',
null, $suppressLogPage->getName()->text() ) .
"\n" );
857 LogEventsList::showLogExtract( $out,
'suppress', $this->mTargetObj );
860 if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
862 $fields[] =
new OOUI\Layout( [
863 'content' =>
new OOUI\HtmlSnippet( $this->
msg(
'undeleteextrahelp' )->parseAsBlock() )
866 $fields[] =
new OOUI\FieldLayout(
867 new OOUI\TextInputWidget( [
868 'name' =>
'wpComment',
869 'inputId' =>
'wpComment',
871 'value' => $this->mComment,
876 'maxLength' => CommentStore::COMMENT_CHARACTER_LIMIT,
879 'label' => $this->
msg(
'undeletecomment' )->text(),
884 $fields[] =
new OOUI\FieldLayout(
886 'content' =>
new OOUI\HorizontalLayout( [
888 new OOUI\ButtonInputWidget( [
890 'inputId' =>
'mw-undelete-submit',
892 'label' => $this->
msg(
'undeletebtn' )->text(),
893 'flags' => [
'primary',
'progressive' ],
896 new OOUI\ButtonInputWidget( [
898 'inputId' =>
'mw-undelete-invert',
900 'label' => $this->
msg(
'undeleteinvert' )->text()
907 if ( $permissionManager->userHasRight( $this->getUser(),
'suppressrevision' ) ) {
908 $fields[] =
new OOUI\FieldLayout(
909 new OOUI\CheckboxInputWidget( [
910 'name' =>
'wpUnsuppress',
911 'inputId' =>
'mw-undelete-unsuppress',
915 'label' => $this->
msg(
'revdelete-unsuppress' )->text(),
921 $fieldset =
new OOUI\FieldsetLayout( [
922 'label' => $this->
msg(
'undelete-fieldset-title' )->text(),
923 'id' =>
'mw-undelete-table',
927 $form->appendContent(
928 new OOUI\PanelLayout( [
932 'content' => $fieldset,
934 new OOUI\HtmlSnippet(
935 Html::hidden(
'target', $this->mTarget ) .
936 Html::hidden(
'wpEditToken', $this->
getUser()->getEditToken() )
942 $history .= Xml::element(
'h2',
null, $this->
msg(
'history' )->text() ) .
"\n";
944 if ( $haveRevisions ) {
945 # Show the page's stored (deleted) history
947 if ( $permissionManager->userHasRight( $this->getUser(),
'deleterevision' ) ) {
948 $history .= Html::element(
953 'class' =>
'deleterevision-log-submit mw-log-deleterevision-button'
955 $this->
msg(
'showhideselectedversions' )->text()
959 $history .=
'<ul class="mw-undelete-revlist">';
960 $remaining = $revisions->numRows();
961 $earliestLiveTime = $this->mTargetObj->getEarliestRevTime();
963 foreach ( $revisions as $row ) {
970 $out->addWikiMsg(
'nohistory' );
974 $history .= Xml::element(
'h2',
null, $this->
msg(
'filehist' )->text() ) .
"\n";
975 $history .=
'<ul class="mw-undelete-revlist">';
976 foreach ( $files as $row ) {
983 if ( $this->mAllowed ) {
984 # Slip in the hidden controls here
985 $misc = Html::hidden(
'target', $this->mTarget );
986 $misc .= Html::hidden(
'wpEditToken', $this->
getUser()->getEditToken() );
989 $form->appendContent(
new OOUI\HtmlSnippet( $history ) );
990 $out->addHTML( $form );
992 $out->addHTML( $history );
999 $revRecord = MediaWikiServices::getInstance()
1000 ->getRevisionFactory()
1001 ->newRevisionFromArchiveRow(
1003 RevisionFactory::READ_NORMAL,
1010 if ( $this->mAllowed ) {
1011 if ( $this->mInvert ) {
1012 if ( in_array( $ts, $this->mTargetTimestamp ) ) {
1013 $checkBox = Xml::check(
"ts$ts" );
1015 $checkBox = Xml::check(
"ts$ts",
true );
1018 $checkBox = Xml::check(
"ts$ts" );
1026 if ( $this->mCanView ) {
1029 if ( !RevisionRecord::userCanBitfield(
1030 $revRecord->getVisibility(),
1031 RevisionRecord::DELETED_TEXT,
1034 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1035 $last = $this->
msg(
'diff' )->escaped();
1036 } elseif ( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1037 $pageLink = $this->
getPageLink( $revRecord, $titleObj, $ts );
1040 $this->
msg(
'diff' )->text(),
1043 'target' => $this->mTargetObj->getPrefixedText(),
1049 $pageLink = $this->
getPageLink( $revRecord, $titleObj, $ts );
1050 $last = $this->
msg(
'diff' )->escaped();
1053 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1054 $last = $this->
msg(
'diff' )->escaped();
1061 $minor = $revRecord->isMinor() ? ChangesList::flag(
'minor' ) :
'';
1064 $size = $row->ar_len;
1065 if ( $size !==
null ) {
1080 $attribs[
'class'] = implode(
' ', $classes );
1083 $revisionRow = $this->
msg(
'undelete-revision-row2' )
1096 return Xml::tags(
'li', $attribs, $revisionRow ) .
"\n";
1105 if ( $this->mCanView && $row->fa_storage_key ) {
1106 if ( $this->mAllowed ) {
1107 $checkBox = Xml::check(
'fileid' . $row->fa_id );
1109 $key = urlencode( $row->fa_storage_key );
1112 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1115 $data = $this->
msg(
'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text();
1116 $bytes = $this->
msg(
'parentheses' )
1117 ->plaintextParams( $this->
msg(
'nbytes' )->numParams( $row->fa_size )->text() )
1119 $data = htmlspecialchars( $data .
' ' . $bytes );
1123 $canHide = $this->
isAllowed(
'deleterevision' );
1124 if ( $canHide || (
$file->getVisibility() && $this->isAllowed(
'deletedhistory' ) ) ) {
1125 if ( !
$file->userCan( File::DELETED_RESTRICTED, $user ) ) {
1130 'type' =>
'filearchive',
1131 'target' => $this->mTargetObj->getPrefixedDBkey(),
1132 'ids' => $row->fa_id
1135 $file->isDeleted( File::DELETED_RESTRICTED ), $canHide );
1141 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1154 $time = $this->
getLanguage()->userTimeAndDate( $ts, $user );
1156 if ( !RevisionRecord::userCanBitfield(
1158 RevisionRecord::DELETED_TEXT,
1161 return '<span class="history-deleted">' . $time .
'</span>';
1169 'target' => $this->mTargetObj->getPrefixedText(),
1174 if ( $revRecord->
isDeleted( RevisionRecord::DELETED_TEXT ) ) {
1175 $link =
'<span class="history-deleted">' . $link .
'</span>';
1193 $time = $this->
getLanguage()->userTimeAndDate( $ts, $user );
1195 if ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
1196 return '<span class="history-deleted">' . htmlspecialchars( $time ) .
'</span>';
1204 'target' => $this->mTargetObj->getPrefixedText(),
1206 'token' => $user->getEditToken( $key )
1210 if (
$file->isDeleted( File::DELETED_FILE ) ) {
1211 $link =
'<span class="history-deleted">' . $link .
'</span>';
1224 if ( !
$file->userCan( File::DELETED_USER, $this->getUser() ) ) {
1225 return '<span class="history-deleted">' .
1226 $this->
msg(
'rev-deleted-user' )->escaped() .
1233 if (
$file->isDeleted( File::DELETED_USER ) ) {
1234 $link =
'<span class="history-deleted">' . $link .
'</span>';
1247 if ( !
$file->userCan( File::DELETED_COMMENT, $this->getUser() ) ) {
1248 return '<span class="history-deleted"><span class="comment">' .
1249 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span></span>';
1254 if (
$file->isDeleted( File::DELETED_COMMENT ) ) {
1255 $link =
'<span class="history-deleted">' . $link .
'</span>';
1262 if ( $this->
getConfig()->
get(
'UploadMaintenance' )
1263 && $this->mTargetObj->getNamespace() ==
NS_FILE
1265 throw new ErrorPageError(
'undelete-error',
'filedelete-maintenance' );
1272 $this->
getHookRunner()->onUndeleteForm__undelete( $archive, $this->mTargetObj );
1273 $ok = $archive->undeleteAsUser(
1274 $this->mTargetTimestamp,
1277 $this->mFileVersions,
1281 if ( is_array( $ok ) ) {
1284 $this->mTargetObj, $this->mFileVersions, $this->
getUser(), $this->mComment );
1290 $out->setPageTitle( $this->
msg(
'undelete-error' ) );
1294 $status = $archive->getRevisionStatus();
1295 if ( $status && !$status->isGood() ) {
1296 $out->wrapWikiTextAsInterface(
1298 '<div id="mw-error-cannotundelete">' .
1299 $status->getWikiText(
1302 $this->getLanguage()
1308 $status = $archive->getFileStatus();
1309 if ( $status && !$status->isGood() ) {
1310 $out->wrapWikiTextAsInterface(
1312 $status->getWikiText(
1313 'undelete-error-short',
1314 'undelete-error-long',
1315 $this->getLanguage()
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfScript( $script='index')
Get the path to a specified script file, respecting file extensions; this is a wrapper around $wgScri...
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Class representing a row of the 'filearchive' table.
static newFromRow( $row)
Loads a file object from the filearchive table Stable to override.
An error page which can definitely be safely rendered using the OutputPage.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static revComment( $rev, $local=false, $isPublic=false, $useParentheses=true)
Wrap and format the given revision's comment block, if the current user is allowed to view it.
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
static formatRevisionSize( $size)
static commentBlock( $comment, $title=null, $local=false, $wikiId=null, $useParentheses=true)
Wrap a comment in standard punctuation and formatting if it's non-empty, otherwise return empty strin...
static revUserTools( $rev, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
static getRevDeleteLink(User $user, $rev, LinkTarget $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
Class to simplify the use of log pages.
Used to show archived pages and eventually restore them.
Show an error when a user tries to do something they do not have the necessary permissions for.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!...
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
checkReadOnly()
If the wiki is currently in readonly mode, throws a ReadOnlyError.
displayRestrictionError()
Output an error message telling the user what access level they have to have Stable to override.
getPageTitle( $subpage=false)
Get a self-referential title object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
getLanguage()
Shortcut to get user's language.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
MediaWiki Linker LinkRenderer null $linkRenderer
Special page allowing users with the appropriate permissions to view and restore deleted content.
redirectToRevDel()
Convert submitted form data to format expected by RevisionDelete and redirect the request.
showList( $result)
Generic list of deleted pages.
getFileComment( $file)
Fetch file upload comment if it's available to this user.
showDiff(RevisionRecord $previousRevRecord, RevisionRecord $currentRevRecord)
Build a diff display between this and the previous either deleted or non-deleted edit.
int[] null $mFileVersions
showFileConfirmationForm( $key)
Show a form confirming whether a tokenless user really wants to see a file.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
showFile( $key)
Show a deleted file version requested by the visitor.
diffHeader(RevisionRecord $revRecord, $prefix)
getFileUser( $file)
Fetch file's user id if it's available to this user.
string $mSearchPrefix
Search prefix.
execute( $par)
Default execute method Checks user permissions.
showRevision( $timestamp)
getFileLink( $file, $titleObj, $ts, $key)
Fetch image view link if it's available to all users.
checkPermissions()
Checks if userCanExecute, and if not throws a PermissionsError.Stable to override 1....
doesWrites()
Indicates whether this special page may perform database writes.
isAllowed( $permission, User $user=null)
Checks whether a user is allowed the permission for the specific title if one is set.
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
getPageLink(RevisionRecord $revRecord, $titleObj, $ts)
Fetch revision text link if it's available to all users.
formatRevisionRow( $row, $earliestLiveTime, $remaining)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Content object implementation for representing flat text.
Represents a title within MediaWiki.
Show an error when the user tries to do something whilst blocked.
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!isset( $args[0])) $lang