48 $services = MediaWikiServices::getInstance();
49 $this->watchlistManager = $services->getWatchlistManager();
50 $this->linkRenderer = $services->getLinkRenderer();
51 $this->backlinkCacheFactory = $services->getBacklinkCacheFactory();
64 $this->
addHelpLink(
'Help:Sysop deleting and undeleting' );
80 $permissionStatus = PermissionStatus::newEmpty();
90 # Better double-check that it hasn't been deleted yet!
92 $request->wasPosted() ? WikiPage::READ_LATEST : WikiPage::READ_NORMAL
95 $deleteLogPage =
new LogPage(
'delete' );
97 $outputPage->setPageTitle(
$context->
msg(
'cannotdelete-title',
$title->getPrefixedText() ) );
98 $outputPage->wrapWikiMsg(
"<div class=\"error mw-error-cannotdelete\">\n$1\n</div>",
101 $outputPage->addHTML(
102 Xml::element(
'h2',
null, $deleteLogPage->getName()->text() )
104 LogEventsList::showLogExtract(
113 $deleteReasonList = $request->getText(
'wpDeleteReasonList',
'other' );
114 $deleteReason = $request->getText(
'wpReason' );
116 if ( $deleteReasonList ==
'other' ) {
117 $reason = $deleteReason;
118 } elseif ( $deleteReason !=
'' ) {
120 $colonseparator =
wfMessage(
'colon-separator' )->inContentLanguage()->text();
121 $reason = $deleteReasonList . $colonseparator . $deleteReason;
123 $reason = $deleteReasonList;
126 if ( $request->wasPosted() && $user->matchEditToken( $request->getVal(
'wpEditToken' ),
127 [
'delete', $this->getTitle()->getPrefixedText() ] )
129 # Flag to hide all contents of the archived revisions
131 $suppress = $request->getCheck(
'wpSuppress' ) &&
146 ->getAutoDeleteReason( $hasHistory );
147 }
catch ( Exception $e ) {
148 # if a page is horribly broken, we still want to be able to
149 # delete it. So be lenient about errors here.
150 wfDebug(
"Error while building auto delete summary: $e" );
165 $revisions = $edits = (int)
$dbr->selectField(
168 [
'rev_page' =>
$title->getArticleID() ],
174 '<strong class="mw-delete-warning-revisions">' .
175 $context->
msg(
'historywarning' )->numParams( $revisions )->parse() .
176 $context->
msg(
'word-separator' )->escaped() . $this->linkRenderer->makeKnownLink(
180 [
'action' =>
'history' ] ) .
184 if (
$title->isBigDeletion() ) {
188 'delete-warning-toobig',
200 if ( !
$file->exists() || !
$file->isLocal() ||
$file->getRedirected() ) {
205 '@phan-var LocalFile $file';
208 $services = MediaWikiServices::getInstance();
212 $services->getReadOnlyMode(),
213 $services->getRepoGroup(),
214 $services->getWatchlistManager(),
216 $services->getUserOptionsLookup()
225 wfDebug(
"Article::confirmDelete" );
229 $outputPage = $ctx->getOutput();
230 $outputPage->setPageTitle(
wfMessage(
'delete-confirm',
$title->getPrefixedText() ) );
231 $outputPage->addBacklinkSubtitle(
$title );
232 $outputPage->setRobotPolicy(
'noindex,nofollow' );
233 $outputPage->addModules(
'mediawiki.action.delete' );
234 $outputPage->addModuleStyles(
'mediawiki.action.styles' );
236 $backlinkCache = $this->backlinkCacheFactory->getBacklinkCache(
$title );
237 if ( $backlinkCache->hasLinks(
'pagelinks' ) || $backlinkCache->hasLinks(
'templatelinks' ) ) {
238 $outputPage->addHtml(
240 $outputPage->msg(
'deleting-backlinks-warning' )->parse(),
246 $subpageQueryLimit = 51;
247 $subpages =
$title->getSubpages( $subpageQueryLimit );
248 $subpageCount = count( $subpages );
249 if ( $subpageCount > 0 ) {
250 $outputPage->addHtml(
252 $outputPage->msg(
'deleting-subpages-warning',
Message::numParam( $subpageCount ) )->parse(),
257 $outputPage->addWikiMsg(
'confirmdeletetext' );
262 $services = MediaWikiServices::getInstance();
263 $checkWatch = $services->getUserOptionsLookup()->getBoolOption( $user,
'watchdeletion' ) ||
264 $this->watchlistManager->isWatched( $user,
$title );
266 $outputPage->enableOOUI();
270 $suppressAllowed = $this->
getContext()->getAuthority()->isAllowed(
'suppressrevision' );
271 $dropDownReason = $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->text();
273 if ( $suppressAllowed ) {
274 $dropDownReason .=
"\n" . $ctx->msg(
'deletereason-dropdown-suppress' )
275 ->inContentLanguage()->text();
280 [
'other' => $ctx->msg(
'deletereasonotherlist' )->inContentLanguage()->text() ]
284 $fields[] =
new OOUI\FieldLayout(
285 new OOUI\DropdownInputWidget( [
286 'name' =>
'wpDeleteReasonList',
287 'inputId' =>
'wpDeleteReasonList',
291 'options' => $options
294 'label' => $ctx->msg(
'deletecomment' )->text(),
302 $fields[] =
new OOUI\FieldLayout(
303 new OOUI\TextInputWidget( [
304 'name' =>
'wpReason',
305 'inputId' =>
'wpReason',
307 'maxLength' => CommentStore::COMMENT_CHARACTER_LIMIT,
313 'label' => $ctx->msg(
'deleteotherreason' )->text(),
318 if ( $user->isRegistered() ) {
319 $fields[] =
new OOUI\FieldLayout(
320 new OOUI\CheckboxInputWidget( [
322 'inputId' =>
'wpWatch',
324 'selected' => $checkWatch,
327 'label' => $ctx->msg(
'watchthis' )->text(),
333 if ( $suppressAllowed ) {
334 $fields[] =
new OOUI\FieldLayout(
335 new OOUI\CheckboxInputWidget( [
336 'name' =>
'wpSuppress',
337 'inputId' =>
'wpSuppress',
341 'label' => $ctx->msg(
'revdelete-suppress' )->text(),
348 $fields[] =
new OOUI\FieldLayout(
349 new OOUI\ButtonInputWidget( [
350 'name' =>
'wpConfirmB',
351 'inputId' =>
'wpConfirmB',
353 'value' => $ctx->msg(
'deletepage' )->text(),
354 'label' => $ctx->msg(
'deletepage' )->text(),
355 'flags' => [
'primary',
'destructive' ],
363 $fieldset =
new OOUI\FieldsetLayout( [
364 'label' => $ctx->msg(
'delete-legend' )->text(),
365 'id' =>
'mw-delete-table',
369 $form =
new OOUI\FormLayout( [
371 'action' =>
$title->getLocalURL(
'action=delete' ),
372 'id' =>
'deleteconfirm',
374 $form->appendContent(
376 new OOUI\HtmlSnippet(
377 Html::hidden(
'wpEditToken', $user->getEditToken( [
'delete',
$title->getPrefixedText() ] ) )
381 $outputPage->addHTML(
382 new OOUI\PanelLayout( [
383 'classes' => [
'deletepage-wrapper' ],
393 if ( $suppressAllowed ) {
394 $link .= $this->linkRenderer->makeKnownLink(
395 $ctx->msg(
'deletereason-dropdown-suppress' )->inContentLanguage()->getTitle(),
396 $ctx->msg(
'delete-edit-reasonlist-suppress' )->text(),
398 [
'action' =>
'edit' ]
400 $link .= $ctx->msg(
'pipe-separator' )->escaped();
402 $link .= $this->linkRenderer->makeKnownLink(
403 $ctx->msg(
'deletereason-dropdown' )->inContentLanguage()->getTitle(),
404 $ctx->msg(
'delete-edit-reasonlist' )->text(),
406 [
'action' =>
'edit' ]
408 $outputPage->addHTML(
'<p class="mw-delete-editreasons">' . $link .
'</p>' );
411 $deleteLogPage =
new LogPage(
'delete' );
412 $outputPage->addHTML( Xml::element(
'h2',
null, $deleteLogPage->getName()->text() ) );
$wgDeleteRevisionsLimit
Optional to restrict deletion of pages with higher revision counts to users with the 'bigdelete' perm...
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfReadOnly()
Check whether the wiki is in read-only mode.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
WikiPage Article ImagePage CategoryPage Page $page
Page on which we're performing the action.
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getTitle()
Shortcut to get the Title object from the page.
getContext()
Get the IContextSource in use here.
IContextSource $context
IContextSource if specified; otherwise we'll use the Context from the Page.
getArticle()
Get a Article object.
useTransactionalTimeLimit()
Call wfTransactionalTimeLimit() if this request was POSTed.
array $fields
The fields used to create the HTMLForm.
doDelete( $reason, $suppress=false, $immediate=false)
Perform a deletion and output success or failure messages.
getPage()
Get the WikiPage object of this instance.
onView()
Show something on GET request.
getName()
Return the name of the action this object responds to.
LinkRenderer $linkRenderer
__construct(Page $page, IContextSource $context=null)
Only public since 1.21.to call
WatchlistManager $watchlistManager
doesWrites()
Indicates whether this action may perform database writes.
BacklinkCacheFactory $backlinkCacheFactory
tempConfirmDelete(string $reason)
Class for viewing MediaWiki file description pages.
static showLogExtract(&$out, $types=[], $page='', $user='', $param=[])
Show log extract.
Class to simplify the use of log pages.
Show an error when a user tries to do something they do not have the necessary permissions for.
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
static listDropDownOptions( $list, $params=[])
Build options for a drop-down box from a textual list.
static listDropDownOptionsOoui( $options)
Convert options for a drop-down box into a format accepted by OOUI\DropdownInputWidget etc.
Interface for objects which can provide a MediaWiki context on request.
msg( $key,... $params)
This is the method for getting translated interface messages.
Interface for type hinting (accepts WikiPage, Article, ImagePage, CategoryPage)
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.