134 parent::__construct(
'Undelete',
'deletedhistory' );
156 $this->mAction = $request->getRawVal(
'action' );
157 if ( $par !==
null && $par !==
'' ) {
158 $this->mTarget = $par;
160 $this->mTarget = $request->getVal(
'target' );
163 $this->mTargetObj =
null;
165 if ( $this->mTarget !==
null && $this->mTarget !==
'' ) {
166 $this->mTargetObj = Title::newFromText( $this->mTarget );
169 $this->mSearchPrefix = $request->getText(
'prefix' );
170 $time = $request->getVal(
'timestamp' );
171 $this->mTimestamp = $time ?
wfTimestamp( TS_MW, $time ) :
'';
172 $this->mFilename = $request->getVal(
'file' );
174 $posted = $request->wasPosted() &&
175 $user->matchEditToken( $request->getVal(
'wpEditToken' ) );
176 $this->mRestore = $request->getCheck(
'restore' ) && $posted;
177 $this->mRevdel = $request->getCheck(
'revdel' ) && $posted;
178 $this->mInvert = $request->getCheck(
'invert' ) && $posted;
179 $this->mPreview = $request->getCheck(
'preview' ) && $posted;
180 $this->mDiff = $request->getCheck(
'diff' );
181 $this->mDiffOnly = $request->getBool(
'diffonly',
182 $this->userOptionsLookup->getOption( $this->getUser(),
'diffonly' ) );
183 $this->mComment = $request->getText(
'wpComment' );
184 $this->mUnsuppress = $request->getVal(
'wpUnsuppress' ) &&
185 $this->permissionManager->userHasRight( $user,
'suppressrevision' );
186 $this->mToken = $request->getVal(
'token' );
189 $this->mAllowed =
true;
190 $this->mCanView =
true;
191 } elseif ( $this->
isAllowed(
'deletedtext' ) ) {
192 $this->mAllowed =
false;
193 $this->mCanView =
true;
194 $this->mRestore =
false;
196 $this->mAllowed =
false;
197 $this->mCanView =
false;
198 $this->mTimestamp =
'';
199 $this->mRestore =
false;
202 if ( $this->mRestore || $this->mInvert ) {
204 $this->mFileVersions = [];
205 foreach ( $request->getValues() as $key => $val ) {
207 if ( preg_match(
'/^ts(\d{14})$/', $key,
$matches ) ) {
208 array_push( $timestamps,
$matches[1] );
211 if ( preg_match(
'/^fileid(\d+)$/', $key,
$matches ) ) {
212 $this->mFileVersions[] = intval(
$matches[1] );
215 rsort( $timestamps );
216 $this->mTargetTimestamp = $timestamps;
229 $user = $user ?: $this->
getUser();
230 $block = $user->getBlock();
232 if ( $this->mTargetObj !==
null ) {
233 return $this->permissionManager->userCan( $permission, $user, $this->mTargetObj );
235 $hasRight = $this->permissionManager->userHasRight( $user, $permission );
236 $sitewideBlock = $block && $block->isSitewide();
237 return $permission ===
'undelete' ? ( $hasRight && !$sitewideBlock ) : $hasRight;
242 return $this->
isAllowed( $this->mRestriction, $user );
253 if ( !parent::userCanExecute( $user ) ) {
260 $this->mTargetObj && $this->permissionManager->isBlockedFrom( $user, $this->mTargetObj ) ) {
277 $this->
addHelpLink(
'Help:Deletion_and_undeletion' );
284 if ( $this->mTargetObj ===
null ) {
285 $out->addWikiMsg(
'undelete-header' );
287 # Not all users can just browse every deleted page from the list
288 if ( $this->permissionManager->userHasRight( $user,
'browsearchive' ) ) {
296 if ( $this->mAllowed ) {
297 $out->setPageTitle( $this->
msg(
'undeletepage' ) );
299 $out->setPageTitle( $this->
msg(
'viewdeletedpage' ) );
302 $this->
getSkin()->setRelevantTitle( $this->mTargetObj );
304 if ( $this->mTimestamp !==
'' ) {
306 } elseif ( $this->mFilename !==
null && $this->mTargetObj->inNamespace(
NS_FILE ) ) {
309 if ( !
$file->exists() ) {
310 $out->addWikiMsg(
'filedelete-nofile', $this->mFilename );
311 } elseif ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
312 if (
$file->isDeleted( File::DELETED_RESTRICTED ) ) {
317 } elseif ( !$user->matchEditToken( $this->mToken, $this->mFilename ) ) {
320 $this->
showFile( $this->mFilename );
322 } elseif ( $this->mAction ===
'submit' ) {
323 if ( $this->mRestore ) {
325 } elseif ( $this->mRevdel ) {
343 foreach ( $this->
getRequest()->getValues() as $key => $val ) {
345 if ( preg_match(
"/^ts(\d{14})$/", $key,
$matches ) ) {
346 $revisionRecord = $archive->getRevisionRecordByTimestamp(
$matches[1] );
347 if ( $revisionRecord ) {
349 $revisions[ $revisionRecord->getId() ] = 1;
355 'type' =>
'revision',
357 'target' => $this->mTargetObj->getPrefixedText()
365 $out->setPageTitle( $this->
msg(
'undelete-search-title' ) );
366 $fuzzySearch = $this->
getRequest()->getVal(
'fuzzy',
true );
371 $fields[] =
new OOUI\ActionFieldLayout(
372 new OOUI\TextInputWidget( [
374 'inputId' =>
'prefix',
376 'value' => $this->mSearchPrefix,
379 new OOUI\ButtonInputWidget( [
380 'label' => $this->
msg(
'undelete-search-submit' )->text(),
381 'flags' => [
'primary',
'progressive' ],
382 'inputId' =>
'searchUndelete',
386 'label' =>
new OOUI\HtmlSnippet(
388 $fuzzySearch ?
'undelete-search-full' :
'undelete-search-prefix'
395 $fieldset =
new OOUI\FieldsetLayout( [
396 'label' => $this->
msg(
'undelete-search-box' )->text(),
400 $form =
new OOUI\FormLayout( [
405 $form->appendContent(
407 new OOUI\HtmlSnippet(
408 Html::hidden(
'title', $this->
getPageTitle()->getPrefixedDBkey() ) .
409 Html::hidden(
'fuzzy', $fuzzySearch )
414 new OOUI\PanelLayout( [
422 # List undeletable articles
423 if ( $this->mSearchPrefix ) {
426 if ( $fuzzySearch ) {
427 $result = PageArchive::listPagesBySearch( $this->mSearchPrefix );
429 $result = PageArchive::listPagesByPrefix( $this->mSearchPrefix );
444 if ( $result->numRows() == 0 ) {
445 $out->addWikiMsg(
'undelete-no-results' );
450 $out->addWikiMsg(
'undeletepagetext', $this->
getLanguage()->formatNum( $result->numRows() ) );
454 $out->addHTML(
"<ul id='undeleteResultsList'>\n" );
455 foreach ( $result as $row ) {
456 $title = Title::makeTitleSafe( $row->ar_namespace, $row->ar_title );
460 $title->getPrefixedText(),
462 [
'target' =>
$title->getPrefixedText() ]
466 $item = Html::element(
468 [
'class' =>
'mw-invalidtitle' ],
476 $revs = $this->
msg(
'undeleterevisions' )->numParams( $row->count )->parse();
480 [
'class' =>
'undeleteResult' ],
486 $out->addHTML(
"</ul>\n" );
492 if ( !preg_match(
'/[0-9]{14}/', $timestamp ) ) {
499 $archive, $this->mTargetObj )
503 $revRecord = $archive->getRevisionRecordByTimestamp( $timestamp );
509 $out->addWikiMsg(
'undeleterevision-missing' );
513 if ( $revRecord->isDeleted( RevisionRecord::DELETED_TEXT ) ) {
515 $titleText = $this->mTargetObj->getPrefixedDBkey();
516 if ( !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
517 $msg = $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED )
518 ? [
'rev-suppressed-text-permission', $titleText ]
519 : [
'rev-deleted-text-permission', $titleText ];
522 $this->
msg( $msg[0], $msg[1] )->parse(),
529 $msg = $revRecord->isDeleted( RevisionRecord::DELETED_RESTRICTED )
530 ? [
'rev-suppressed-text-view', $titleText ]
531 : [
'rev-deleted-text-view', $titleText ];
534 $this->
msg( $msg[0], $msg[1] )->parse(),
541 if ( $this->mDiff ) {
542 $previousRevRecord = $archive->getPreviousRevisionRecord( $timestamp );
543 if ( $previousRevRecord ) {
544 $this->
showDiff( $previousRevRecord, $revRecord );
545 if ( $this->mDiffOnly ) {
549 $out->addHTML(
'<hr />' );
551 $out->addWikiMsg(
'undelete-nodiff' );
556 $this->
getPageTitle( $this->mTargetObj->getPrefixedDBkey() ),
557 $this->mTargetObj->getPrefixedText()
564 $time =
$lang->userTimeAndDate( $timestamp, $user );
565 $d =
$lang->userDate( $timestamp, $user );
566 $t =
$lang->userTime( $timestamp, $user );
571 RevisionRecord::FOR_THIS_USER,
582 'id' =>
'mw-undelete-revision',
583 'class' => $this->mPreview || $isText ?
'warningbox' :
'',
589 if ( !$this->mDiff ) {
596 $out->addHTML(
"$revdel " );
605 $out->addHTML( Html::closeElement(
'div' ) );
607 if ( $this->mPreview || !$isText ) {
610 $popts = $out->parserOptions();
612 $rendered = $this->revisionRenderer->getRenderedRevision(
616 [
'audience' => RevisionRecord::FOR_THIS_USER ]
621 $pout = $rendered->getRevisionParserOutput();
623 $out->addParserOutput( $pout, [
624 'enableSectionEditLinks' =>
false,
632 '@phan-var TextContent $content';
635 $sourceView = Xml::element(
'textarea', [
636 'readonly' =>
'readonly',
641 $buttonFields[] =
new OOUI\ButtonInputWidget( [
644 'label' => $this->
msg(
'showpreview' )->text()
650 $buttonFields[] =
new OOUI\ButtonInputWidget( [
653 'label' => $this->
msg(
'showdiff' )->text()
658 Xml::openElement(
'div', [
659 'style' =>
'clear: both' ] ) .
660 Xml::openElement(
'form', [
662 'action' => $this->
getPageTitle()->getLocalURL( [
'action' =>
'submit' ] ) ] ) .
663 Xml::element(
'input', [
666 'value' => $this->mTargetObj->getPrefixedDBkey() ] ) .
667 Xml::element(
'input', [
669 'name' =>
'timestamp',
670 'value' => $timestamp ] ) .
671 Xml::element(
'input', [
673 'name' =>
'wpEditToken',
674 'value' => $user->getEditToken() ] ) .
675 new OOUI\FieldLayout(
677 'content' =>
new OOUI\HorizontalLayout( [
678 'items' => $buttonFields
682 Xml::closeElement(
'form' ) .
683 Xml::closeElement(
'div' )
701 $diffContext->setTitle( $currentTitle );
702 $diffContext->setWikiPage( $this->wikiPageFactory->newFromTitle( $currentTitle ) );
704 $contentModel = $currentRevRecord->
getSlot(
709 $diffEngine = $this->contentHandlerFactory->getContentHandler( $contentModel )
710 ->createDifferenceEngine( $diffContext );
712 $diffEngine->setRevisions( $previousRevRecord, $currentRevRecord );
713 $diffEngine->showDiffStyle();
714 $formattedDiff = $diffEngine->getDiff(
719 $this->
getOutput()->addHTML(
"<div>$formattedDiff</div>\n" );
733 'target' => $this->mTargetObj->getPrefixedText(),
739 $targetQuery = [
'oldid' => $revRecord->
getId() ];
751 $minor = $revRecord->
isMinor() ? ChangesList::flag(
'minor' ) :
'';
753 $dbr = $this->loadBalancer->getConnectionRef( ILoadBalancer::DB_REPLICA );
754 $tagIds =
$dbr->selectFieldValues(
757 [
'ct_rev_id' => $revRecord->
getId() ],
761 foreach ( $tagIds as $tagId ) {
763 $tags[] = $this->changeTagDefStore->getName( (
int)$tagId );
768 $tags = implode(
',', $tags );
773 return '<div id="mw-diff-' . $prefix .
'title1"><strong>' .
786 '<div id="mw-diff-' . $prefix .
'title2">' .
789 '<div id="mw-diff-' . $prefix .
'title3">' .
792 '<div id="mw-diff-' . $prefix .
'title5">' .
793 $tagSummary[0] .
'<br />' .
806 $out->addWikiMsg(
'undelete-show-file-confirm',
807 $this->mTargetObj->getText(),
808 $lang->userDate(
$file->getTimestamp(), $user ),
809 $lang->userTime(
$file->getTimestamp(), $user ) );
811 Xml::openElement(
'form', [
814 'target' => $this->mTarget,
816 'token' => $user->getEditToken( $key ),
820 Xml::submitButton( $this->msg(
'undelete-show-file-submit' )->text() ) .
832 # We mustn't allow the output to be CDN cached, otherwise
833 # if an admin previews a deleted image, and it's cached, then
834 # a user without appropriate permissions can toddle off and
835 # nab the image, and CDN will serve it
837 $response->header(
'Expires: ' . gmdate(
'D, d M Y H:i:s', 0 ) .
' GMT' );
838 $response->header(
'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
839 $response->header(
'Pragma: no-cache' );
841 $path = $this->localRepo->getZonePath(
'deleted' ) .
'/' . $this->localRepo->getDeletedHashPath( $key ) . $key;
842 $this->localRepo->streamFileWithStatus(
$path );
849 if ( $this->mAllowed ) {
850 $out->addModules(
'mediawiki.misc-authed-ooui' );
853 "<div class='mw-undelete-pagetitle'>\n$1\n</div>\n",
854 [
'undeletepagetitle',
wfEscapeWikiText( $this->mTargetObj->getPrefixedText() ) ]
859 $this->
getHookRunner()->onUndeleteForm__showHistory( $archive, $this->mTargetObj );
861 $out->addHTML( Html::openElement(
'div', [
'class' =>
'mw-undelete-history' ] ) );
862 if ( $this->mAllowed ) {
863 $out->addWikiMsg(
'undeletehistory' );
864 $out->addWikiMsg(
'undeleterevdel' );
866 $out->addWikiMsg(
'undeletehistorynoadmin' );
868 $out->addHTML( Html::closeElement(
'div' ) );
870 # List all stored revisions
871 $revisions = $archive->listRevisions();
872 $files = $archive->listFiles();
874 $haveRevisions = $revisions && $revisions->numRows() > 0;
875 $haveFiles = $files && $files->numRows() > 0;
877 # Batch existence check on user and talk pages
878 if ( $haveRevisions || $haveFiles ) {
879 $batch = $this->linkBatchFactory->newLinkBatch();
880 if ( $haveRevisions ) {
881 foreach ( $revisions as $row ) {
882 $batch->add(
NS_USER, $row->ar_user_text );
885 $revisions->seek( 0 );
888 foreach ( $files as $row ) {
889 $batch->add(
NS_USER, $row->fa_user_text );
897 if ( $this->mAllowed ) {
900 $action = $this->
getPageTitle()->getLocalURL( [
'action' =>
'submit' ] );
901 # Start the form here
902 $form =
new OOUI\FormLayout( [
909 # Show relevant lines from the deletion log:
910 $deleteLogPage =
new LogPage(
'delete' );
911 $out->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) .
"\n" );
912 LogEventsList::showLogExtract( $out,
'delete', $this->mTargetObj );
913 # Show relevant lines from the suppression log:
914 $suppressLogPage =
new LogPage(
'suppress' );
915 if ( $this->permissionManager->userHasRight( $this->getUser(),
'suppressionlog' ) ) {
916 $out->addHTML( Xml::element(
'h2',
null, $suppressLogPage->getName()->text() ) .
"\n" );
917 LogEventsList::showLogExtract( $out,
'suppress', $this->mTargetObj );
920 if ( $this->mAllowed && ( $haveRevisions || $haveFiles ) ) {
922 $fields[] =
new OOUI\Layout( [
923 'content' =>
new OOUI\HtmlSnippet( $this->
msg(
'undeleteextrahelp' )->parseAsBlock() )
926 $fields[] =
new OOUI\FieldLayout(
927 new OOUI\TextInputWidget( [
928 'name' =>
'wpComment',
929 'inputId' =>
'wpComment',
931 'value' => $this->mComment,
936 'maxLength' => CommentStore::COMMENT_CHARACTER_LIMIT,
939 'label' => $this->
msg(
'undeletecomment' )->text(),
944 $fields[] =
new OOUI\FieldLayout(
946 'content' =>
new OOUI\HorizontalLayout( [
948 new OOUI\ButtonInputWidget( [
950 'inputId' =>
'mw-undelete-submit',
952 'label' => $this->
msg(
'undeletebtn' )->text(),
953 'flags' => [
'primary',
'progressive' ],
956 new OOUI\ButtonInputWidget( [
958 'inputId' =>
'mw-undelete-invert',
960 'label' => $this->
msg(
'undeleteinvert' )->text()
967 if ( $this->permissionManager->userHasRight( $this->getUser(),
'suppressrevision' ) ) {
968 $fields[] =
new OOUI\FieldLayout(
969 new OOUI\CheckboxInputWidget( [
970 'name' =>
'wpUnsuppress',
971 'inputId' =>
'mw-undelete-unsuppress',
975 'label' => $this->
msg(
'revdelete-unsuppress' )->text(),
981 $fieldset =
new OOUI\FieldsetLayout( [
982 'label' => $this->
msg(
'undelete-fieldset-title' )->text(),
983 'id' =>
'mw-undelete-table',
987 $form->appendContent(
988 new OOUI\PanelLayout( [
992 'content' => $fieldset,
994 new OOUI\HtmlSnippet(
995 Html::hidden(
'target', $this->mTarget ) .
996 Html::hidden(
'wpEditToken', $this->
getUser()->getEditToken() )
1002 $history .= Xml::element(
'h2',
null, $this->
msg(
'history' )->text() ) .
"\n";
1004 if ( $haveRevisions ) {
1005 # Show the page's stored (deleted) history
1007 if ( $this->permissionManager->userHasRight( $this->getUser(),
'deleterevision' ) ) {
1008 $history .= Html::element(
1013 'class' =>
'deleterevision-log-submit mw-log-deleterevision-button'
1015 $this->
msg(
'showhideselectedversions' )->text()
1019 $history .= Html::openElement(
'ul', [
'class' =>
'mw-undelete-revlist' ] );
1020 $remaining = $revisions->numRows();
1021 $firstRev = $this->revisionStore->getFirstRevision( $this->mTargetObj );
1022 $earliestLiveTime = $firstRev ? $firstRev->getTimestamp() :
null;
1024 foreach ( $revisions as $row ) {
1029 $history .= Html::closeElement(
'ul' );
1031 $out->addWikiMsg(
'nohistory' );
1035 $history .= Xml::element(
'h2',
null, $this->
msg(
'filehist' )->text() ) .
"\n";
1036 $history .= Html::openElement(
'ul', [
'class' =>
'mw-undelete-revlist' ] );
1037 foreach ( $files as $row ) {
1041 $history .= Html::closeElement(
'ul' );
1044 if ( $this->mAllowed ) {
1045 # Slip in the hidden controls here
1046 $misc = Html::hidden(
'target', $this->mTarget );
1047 $misc .= Html::hidden(
'wpEditToken', $this->
getUser()->getEditToken() );
1050 $form->appendContent(
new OOUI\HtmlSnippet( $history ) );
1051 $out->addHTML( $form );
1053 $out->addHTML( $history );
1060 $revRecord = $this->revisionStore->newRevisionFromArchiveRow(
1062 RevisionStore::READ_NORMAL,
1069 if ( $this->mAllowed ) {
1070 if ( $this->mInvert ) {
1071 if ( in_array( $ts, $this->mTargetTimestamp ) ) {
1072 $checkBox = Xml::check(
"ts$ts" );
1074 $checkBox = Xml::check(
"ts$ts",
true );
1077 $checkBox = Xml::check(
"ts$ts" );
1085 if ( $this->mCanView ) {
1088 if ( !$revRecord->userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
1089 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1090 $last = $this->
msg(
'diff' )->escaped();
1091 } elseif ( $remaining > 0 || ( $earliestLiveTime && $ts > $earliestLiveTime ) ) {
1092 $pageLink = $this->
getPageLink( $revRecord, $titleObj, $ts );
1095 $this->
msg(
'diff' )->text(),
1098 'target' => $this->mTargetObj->getPrefixedText(),
1104 $pageLink = $this->
getPageLink( $revRecord, $titleObj, $ts );
1105 $last = $this->
msg(
'diff' )->escaped();
1108 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1109 $last = $this->
msg(
'diff' )->escaped();
1116 $minor = $revRecord->isMinor() ? ChangesList::flag(
'minor' ) :
'';
1119 $size = $row->ar_len;
1120 if ( $size !==
null ) {
1135 $attribs[
'class'] = implode(
' ', $classes );
1138 $revisionRow = $this->
msg(
'undelete-revision-row2' )
1151 return Xml::tags(
'li', $attribs, $revisionRow ) .
"\n";
1160 if ( $this->mCanView && $row->fa_storage_key ) {
1161 if ( $this->mAllowed ) {
1162 $checkBox = Xml::check(
'fileid' . $row->fa_id );
1164 $key = urlencode( $row->fa_storage_key );
1167 $pageLink = htmlspecialchars( $this->
getLanguage()->userTimeAndDate( $ts, $user ) );
1170 $data = $this->
msg(
'widthheight' )->numParams( $row->fa_width, $row->fa_height )->text();
1171 $bytes = $this->
msg(
'parentheses' )
1172 ->plaintextParams( $this->
msg(
'nbytes' )->numParams( $row->fa_size )->text() )
1174 $data = htmlspecialchars( $data .
' ' . $bytes );
1178 $canHide = $this->
isAllowed(
'deleterevision' );
1179 if ( $canHide || (
$file->getVisibility() && $this->isAllowed(
'deletedhistory' ) ) ) {
1180 if ( !
$file->userCan( File::DELETED_RESTRICTED, $user ) ) {
1185 'type' =>
'filearchive',
1186 'target' => $this->mTargetObj->getPrefixedDBkey(),
1187 'ids' => $row->fa_id
1190 $file->isDeleted( File::DELETED_RESTRICTED ), $canHide );
1196 return "<li>$checkBox $revdlink $pageLink . . $userLink $data $comment</li>\n";
1209 $time = $this->
getLanguage()->userTimeAndDate( $ts, $user );
1211 if ( !$revRecord->
userCan( RevisionRecord::DELETED_TEXT, $this->getAuthority() ) ) {
1214 return Html::rawElement(
1216 [
'class' =>
'history-deleted' ],
1217 htmlspecialchars( $time )
1226 'target' => $this->mTargetObj->getPrefixedText(),
1231 if ( $revRecord->
isDeleted( RevisionRecord::DELETED_TEXT ) ) {
1233 $link =
'<span class="' . $class .
'">' . $link .
'</span>';
1251 $time = $this->
getLanguage()->userTimeAndDate( $ts, $user );
1253 if ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
1255 return Html::rawElement(
1257 [
'class' =>
'history-deleted' ],
1258 htmlspecialchars( $time )
1267 'target' => $this->mTargetObj->getPrefixedText(),
1269 'token' => $user->getEditToken( $key )
1273 if (
$file->isDeleted( File::DELETED_FILE ) ) {
1274 $link =
'<span class="history-deleted">' . $link .
'</span>';
1289 return Html::rawElement(
1291 [
'class' =>
'history-deleted' ],
1292 $this->
msg(
'rev-deleted-user' )->escaped()
1299 if (
$file->isDeleted( File::DELETED_USER ) ) {
1300 $link = Html::rawElement(
1302 [
'class' =>
'history-deleted' ],
1317 if ( !
$file->userCan( File::DELETED_COMMENT, $this->getAuthority() ) ) {
1318 return Html::rawElement(
1320 [
'class' =>
'history-deleted' ],
1323 [
'class' =>
'comment' ],
1324 $this->
msg(
'rev-deleted-comment' )->escaped()
1332 if (
$file->isDeleted( File::DELETED_COMMENT ) ) {
1333 $link = Html::rawElement(
1335 [
'class' =>
'history-deleted' ],
1344 if ( $this->
getConfig()->
get(
'UploadMaintenance' )
1345 && $this->mTargetObj->getNamespace() ===
NS_FILE
1347 throw new ErrorPageError(
'undelete-error',
'filedelete-maintenance' );
1354 $this->
getHookRunner()->onUndeleteForm__undelete( $archive, $this->mTargetObj );
1355 $ok = $archive->undeleteAsUser(
1356 $this->mTargetTimestamp,
1359 $this->mFileVersions,
1363 if ( is_array( $ok ) ) {
1366 $this->mTargetObj, $this->mFileVersions, $this->
getUser(), $this->mComment );
1372 $out->setPageTitle( $this->
msg(
'undelete-error' ) );
1376 $status = $archive->getRevisionStatus();
1377 if ( $status && !$status->isGood() ) {
1378 $out->wrapWikiTextAsInterface(
1380 '<div id="mw-error-cannotundelete">' .
1381 $status->getWikiText(
1384 $this->getLanguage()
1390 $status = $archive->getFileStatus();
1391 if ( $status && !$status->isGood() ) {
1392 $out->wrapWikiTextAsInterface(
1394 $status->getWikiText(
1395 'undelete-error-short',
1396 'undelete-error-long',
1397 $this->getLanguage()
1412 return $this->
prefixSearchString( $search, $limit, $offset, $this->searchEngineFactory );
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.
An error page which can definitely be safely rendered using the OutputPage.
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static getRevisionDeletedClass(RevisionRecord $revisionRecord)
Returns css class of a deleted revision.
static revComment(RevisionRecord $revRecord, $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 revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static getRevDeleteLink(Authority $performer, RevisionRecord $revRecord, LinkTarget $title)
Get a revision-deletion link, or disabled link, or nothing, depending on user permissions & the setti...
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(RevisionRecord $revRecord, $isPublic=false, $useParentheses=true)
Generate a user tool link cluster if the current user is allowed to view it.
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.
A repository that stores files in the local filesystem and registers them in the wiki's own database.
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.
Prioritized list of file repositories.
getLocalRepo()
Get the local repository, i.e.
Factory class for SearchEngine.
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.
LinkRenderer null $linkRenderer
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getAuthority()
Shortcut to get the Authority executing this instance.
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.
prefixSearchString( $search, $limit, $offset, SearchEngineFactory $searchEngineFactory=null)
Perform a regular substring search for prefixSearchSubpages.
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.
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.
RevisionStore $revisionStore
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
IContentHandlerFactory $contentHandlerFactory
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.
RevisionRenderer $revisionRenderer
showFile( $key)
Show a deleted file version requested by the visitor.
PermissionManager $permissionManager
LinkBatchFactory $linkBatchFactory
diffHeader(RevisionRecord $revRecord, $prefix)
NameTableStore $changeTagDefStore
getFileUser( $file)
Fetch file's user id if it's available to this user.
WikiPageFactory $wikiPageFactory
ILoadBalancer $loadBalancer
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.to override 1.19 void|never
doesWrites()
Indicates whether this special page may perform database writes.
UserOptionsLookup $userOptionsLookup
isAllowed( $permission, User $user=null)
Checks whether a user is allowed the permission for the specific title if one is set.
SearchEngineFactory $searchEngineFactory
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)
__construct(PermissionManager $permissionManager, RevisionStore $revisionStore, RevisionRenderer $revisionRenderer, IContentHandlerFactory $contentHandlerFactory, NameTableStore $changeTagDefStore, LinkBatchFactory $linkBatchFactory, RepoGroup $repoGroup, ILoadBalancer $loadBalancer, UserOptionsLookup $userOptionsLookup, WikiPageFactory $wikiPageFactory, SearchEngineFactory $searchEngineFactory)
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