X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMovepage.php;h=298d6c4edb41829a704184540f86338a128f2743;hp=9cc6745b264e335d08c265f77eee5f7a2c76234e;hb=7874fc4bec845ad92960b07e969c65f3c3fe74f2;hpb=b9f443d6174d6ff8a9f1bdf93b4c9b886ef2b91c diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 9cc6745b26..298d6c4edb 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -223,7 +223,7 @@ class MovePageForm extends UnlistedSpecialPage { ( $oldTalk->exists() || ( $oldTitleTalkSubpages && $canMoveSubpage ) ); - $dbr = wfGetDB( DB_SLAVE ); + $dbr = wfGetDB( DB_REPLICA ); if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) { $hasRedirects = $dbr->selectField( 'redirect', '1', [ @@ -462,7 +462,7 @@ class MovePageForm extends UnlistedSpecialPage { 'name' => 'wpMove', 'value' => $this->msg( 'movepagebtn' )->text(), 'label' => $this->msg( 'movepagebtn' )->text(), - 'flags' => [ 'constructive', 'primary' ], + 'flags' => [ 'primary', 'progressive' ], 'type' => 'submit', ] ), [ @@ -783,28 +783,57 @@ class MovePageForm extends UnlistedSpecialPage { LogEventsList::showLogExtract( $out, 'move', $title ); } + /** + * Show subpages of the page being moved. Section is not shown if both current + * namespace does not support subpages and no talk subpages were found. + * + * @param Title $title Page being moved. + */ function showSubpages( $title ) { - if ( !MWNamespace::hasSubpages( $title->getNamespace() ) ) { + $nsHasSubpages = MWNamespace::hasSubpages( $title->getNamespace() ); + $subpages = $title->getSubpages(); + $count = $subpages instanceof TitleArray ? $subpages->count() : 0; + + $titleIsTalk = $title->isTalkPage(); + $subpagesTalk = $title->getTalkPage()->getSubpages(); + $countTalk = $subpagesTalk instanceof TitleArray ? $subpagesTalk->count() : 0; + $totalCount = $count + $countTalk; + + if ( !$nsHasSubpages && $countTalk == 0 ) { return; } - $subpages = $title->getSubpages(); - $count = $subpages instanceof TitleArray ? $subpages->count() : 0; + $this->getOutput()->wrapWikiMsg( + '== $1 ==', + [ 'movesubpage', ( $titleIsTalk ? $count : $totalCount ) ] + ); + + if ( $nsHasSubpages ) { + $this->showSubpagesList( $subpages, $count, 'movesubpagetext', true ); + } + + if ( !$titleIsTalk && $countTalk > 0 ) { + $this->showSubpagesList( $subpagesTalk, $countTalk, 'movesubpagetalktext' ); + } + } + function showSubpagesList( $subpages, $pagecount, $wikiMsg, $noSubpageMsg = false ) { $out = $this->getOutput(); - $out->wrapWikiMsg( '== $1 ==', [ 'movesubpage', $count ] ); # No subpages. - if ( $count == 0 ) { + if ( $pagecount == 0 && $noSubpageMsg ) { $out->addWikiMsg( 'movenosubpage' ); - return; } - $out->addWikiMsg( 'movesubpagetext', $this->getLanguage()->formatNum( $count ) ); + $out->addWikiMsg( $wikiMsg, $this->getLanguage()->formatNum( $pagecount ) ); $out->addHTML( "