* @since 1.21
*/
protected function getContentObject() {
-
if ( $this->mPage->getId() === 0 ) {
# If this is a MediaWiki:x message, then load the messages
# and return the message value for x.
$outputPage->setRevisionTimestamp( $this->mPage->getTimestamp() );
if ( !Hooks::run( 'ArticleContentViewCustom',
- [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] ) ) {
-
+ [ $this->fetchContentObject(), $this->getTitle(), $outputPage ] )
+ ) {
# Allow extensions do their own custom view for certain pages
$outputDone = true;
}
$key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
$loggedIn = $this->getContext()->getUser()->isLoggedIn();
if ( $loggedIn || $cache->get( $key ) ) {
- $logTypes = [ 'delete', 'move' ];
+ $logTypes = [ 'delete', 'move', 'protect' ];
$dbr = wfGetDB( DB_REPLICA );
* @param bool $appendSubtitle [optional]
* @param bool $forceKnown Should the image be shown as a bluelink regardless of existence?
* @return string Containing HTML with redirect link
+ *
+ * @deprecated since 1.30
*/
public function viewRedirect( $target, $appendSubtitle = true, $forceKnown = false ) {
$lang = $this->getTitle()->getPageLanguage();
[ 'delete', $this->getTitle()->getPrefixedText() ] )
) {
# Flag to hide all contents of the archived revisions
- $suppress = $request->getVal( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' );
+ $suppress = $request->getCheck( 'wpSuppress' ) && $user->isAllowed( 'suppressrevision' );
$this->doDelete( $reason, $suppress );
$title = $this->getTitle();
$ctx = $this->getContext();
$outputPage = $ctx->getOutput();
- $useMediaWikiUIEverywhere = $ctx->getConfig()->get( 'UseMediaWikiUIEverywhere' );
$outputPage->setPageTitle( wfMessage( 'delete-confirm', $title->getPrefixedText() ) );
$outputPage->addBacklinkSubtitle( $title );
$outputPage->setRobotPolicy( 'noindex,nofollow' );
+
$backlinkCache = $title->getBacklinkCache();
if ( $backlinkCache->hasLinks( 'pagelinks' ) || $backlinkCache->hasLinks( 'templatelinks' ) ) {
$outputPage->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
'deleting-backlinks-warning' );
}
+
+ $subpageQueryLimit = 51;
+ $subpages = $title->getSubpages( $subpageQueryLimit );
+ $subpageCount = count( $subpages );
+ if ( $subpageCount > 0 ) {
+ $outputPage->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n",
+ [ 'deleting-subpages-warning', Message::numParam( $subpageCount ) ] );
+ }
$outputPage->addWikiMsg( 'confirmdeletetext' );
Hooks::run( 'ArticleConfirmDelete', [ $this, $outputPage, &$reason ] );
$user = $this->getContext()->getUser();
- if ( $user->isAllowed( 'suppressrevision' ) ) {
- $suppress = Html::openElement( 'div', [ 'id' => 'wpDeleteSuppressRow' ] ) .
- Xml::checkLabel( wfMessage( 'revdelete-suppress' )->text(),
- 'wpSuppress', 'wpSuppress', false, [ 'tabindex' => '4' ] ) .
- Html::closeElement( 'div' );
- } else {
- $suppress = '';
- }
$checkWatch = $user->getBoolOption( 'watchdeletion' ) || $user->isWatched( $title );
- $form = Html::openElement( 'form', [ 'method' => 'post',
- 'action' => $title->getLocalURL( 'action=delete' ), 'id' => 'deleteconfirm' ] ) .
- Html::openElement( 'fieldset', [ 'id' => 'mw-delete-table' ] ) .
- Html::element( 'legend', null, wfMessage( 'delete-legend' )->text() ) .
- Html::openElement( 'div', [ 'id' => 'mw-deleteconfirm-table' ] ) .
- Html::openElement( 'div', [ 'id' => 'wpDeleteReasonListRow' ] ) .
- Html::label( wfMessage( 'deletecomment' )->text(), 'wpDeleteReasonList' ) .
- ' ' .
- Xml::listDropDown(
- 'wpDeleteReasonList',
- wfMessage( 'deletereason-dropdown' )->inContentLanguage()->text(),
- wfMessage( 'deletereasonotherlist' )->inContentLanguage()->text(),
- '',
- 'wpReasonDropDown',
- 1
- ) .
- Html::closeElement( 'div' ) .
- Html::openElement( 'div', [ 'id' => 'wpDeleteReasonRow' ] ) .
- Html::label( wfMessage( 'deleteotherreason' )->text(), 'wpReason' ) .
- ' ' .
- Html::input( 'wpReason', $reason, 'text', [
- 'size' => '60',
- 'maxlength' => '255',
- 'tabindex' => '2',
- 'id' => 'wpReason',
- 'class' => 'mw-ui-input-inline',
- 'autofocus'
- ] ) .
- Html::closeElement( 'div' );
-
- # Disallow watching if user is not logged in
- if ( $user->isLoggedIn() ) {
- $form .=
- Xml::checkLabel( wfMessage( 'watchthis' )->text(),
- 'wpWatch', 'wpWatch', $checkWatch, [ 'tabindex' => '3' ] );
- }
-
- $form .=
- Html::openElement( 'div' ) .
- $suppress .
- Xml::submitButton( wfMessage( 'deletepage' )->text(),
- [
- 'name' => 'wpConfirmB',
- 'id' => 'wpConfirmB',
- 'tabindex' => '5',
- 'class' => $useMediaWikiUIEverywhere ? 'mw-ui-button mw-ui-destructive' : '',
- ]
- ) .
- Html::closeElement( 'div' ) .
- Html::closeElement( 'div' ) .
- Xml::closeElement( 'fieldset' ) .
- Html::hidden(
- 'wpEditToken',
- $user->getEditToken( [ 'delete', $title->getPrefixedText() ] )
- ) .
- Xml::closeElement( 'form' );
-
- if ( $user->isAllowed( 'editinterface' ) ) {
- $link = Linker::linkKnown(
- $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(),
- wfMessage( 'delete-edit-reasonlist' )->escaped(),
- [],
- [ 'action' => 'edit' ]
- );
- $form .= '<p class="mw-delete-editreasons">' . $link . '</p>';
+
+ $outputPage->enableOOUI();
+
+ $options = [];
+ $options[] = [
+ 'data' => 'other',
+ 'label' => $ctx->msg( 'deletereasonotherlist' )->inContentLanguage()->text(),
+ ];
+ $list = $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->text();
+ foreach ( explode( "\n", $list ) as $option ) {
+ $value = trim( $option );
+ if ( $value == '' ) {
+ continue;
+ } elseif ( substr( $value, 0, 1 ) == '*' && substr( $value, 1, 1 ) != '*' ) {
+ $options[] = [ 'optgroup' => trim( substr( $value, 1 ) ) ];
+ } elseif ( substr( $value, 0, 2 ) == '**' ) {
+ $options[] = [ 'data' => trim( substr( $value, 2 ) ) ];
+ } else {
+ $options[] = [ 'data' => trim( $value ) ];
}
+ }
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\DropdownInputWidget( [
+ 'name' => 'wpDeleteReasonList',
+ 'inputId' => 'wpDeleteReasonList',
+ 'tabIndex' => 1,
+ 'infusable' => true,
+ 'value' => '',
+ 'options' => $options
+ ] ),
+ [
+ 'label' => $ctx->msg( 'deletecomment' )->text(),
+ 'align' => 'top',
+ ]
+ );
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\TextInputWidget( [
+ 'name' => 'wpReason',
+ 'inputId' => 'wpReason',
+ 'tabIndex' => 2,
+ 'maxLength' => 255,
+ 'infusable' => true,
+ 'value' => $reason,
+ 'autofocus' => true,
+ ] ),
+ [
+ 'label' => $ctx->msg( 'deleteotherreason' )->text(),
+ 'align' => 'top',
+ ]
+ );
- $outputPage->addHTML( $form );
+ if ( $user->isLoggedIn() ) {
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\CheckboxInputWidget( [
+ 'name' => 'wpWatch',
+ 'inputId' => 'wpWatch',
+ 'tabIndex' => 3,
+ 'selected' => $checkWatch,
+ ] ),
+ [
+ 'label' => $ctx->msg( 'watchthis' )->text(),
+ 'align' => 'inline',
+ 'infusable' => true,
+ ]
+ );
+ }
+
+ if ( $user->isAllowed( 'suppressrevision' ) ) {
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\CheckboxInputWidget( [
+ 'name' => 'wpSuppress',
+ 'inputId' => 'wpSuppress',
+ 'tabIndex' => 4,
+ ] ),
+ [
+ 'label' => $ctx->msg( 'revdelete-suppress' )->text(),
+ 'align' => 'inline',
+ 'infusable' => true,
+ ]
+ );
+ }
+
+ $fields[] = new OOUI\FieldLayout(
+ new OOUI\ButtonInputWidget( [
+ 'name' => 'wpConfirmB',
+ 'inputId' => 'wpConfirmB',
+ 'tabIndex' => 5,
+ 'value' => $ctx->msg( 'deletepage' )->text(),
+ 'label' => $ctx->msg( 'deletepage' )->text(),
+ 'flags' => [ 'primary', 'destructive' ],
+ 'type' => 'submit',
+ ] ),
+ [
+ 'align' => 'top',
+ ]
+ );
+
+ $fieldset = new OOUI\FieldsetLayout( [
+ 'label' => $ctx->msg( 'delete-legend' )->text(),
+ 'id' => 'mw-delete-table',
+ 'items' => $fields,
+ ] );
+
+ $form = new OOUI\FormLayout( [
+ 'method' => 'post',
+ 'action' => $title->getLocalURL( 'action=delete' ),
+ 'id' => 'deleteconfirm',
+ ] );
+ $form->appendContent(
+ $fieldset,
+ new OOUI\HtmlSnippet(
+ Html::hidden( 'wpEditToken', $user->getEditToken( [ 'delete', $title->getPrefixedText() ] ) )
+ )
+ );
+
+ $outputPage->addHTML(
+ new OOUI\PanelLayout( [
+ 'classes' => [ 'deletepage-wrapper' ],
+ 'expanded' => false,
+ 'padded' => true,
+ 'framed' => true,
+ 'content' => $form,
+ ] )
+ );
+
+ if ( $user->isAllowed( 'editinterface' ) ) {
+ $link = Linker::linkKnown(
+ $ctx->msg( 'deletereason-dropdown' )->inContentLanguage()->getTitle(),
+ wfMessage( 'delete-edit-reasonlist' )->escaped(),
+ [],
+ [ 'action' => 'edit' ]
+ );
+ $outputPage->addHTML( '<p class="mw-delete-editreasons">' . $link . '</p>' );
+ }
$deleteLogPage = new LogPage( 'delete' );
$outputPage->addHTML( Xml::element( 'h2', null, $deleteLogPage->getName()->text() ) );