$out->addModules( 'mediawiki.misc-authed-ooui' );
$this->addHelpLink( 'Help:Moving a page' );
- $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
- 'movepagetext' :
- 'movepagetext-noredirectfixer'
- );
+ $handlerSupportsRedirects = ContentHandler::getForTitle( $this->oldTitle )
+ ->supportsRedirects();
+
+ if ( $this->getConfig()->get( 'FixDoubleRedirects' ) ) {
+ $out->addWikiMsg( 'movepagetext' );
+ } else {
+ $out->addWikiMsg( $handlerSupportsRedirects ?
+ 'movepagetext-noredirectfixer' :
+ 'movepagetext-noredirectsupport' );
+ }
if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
$out->wrapWikiMsg(
}
if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'articleexists'
- && $newTitle->quickUserCan( 'delete', $user )
+ && MediaWikiServices::getInstance()->getPermissionManager()
+ ->quickUserCan( 'delete', $user, $newTitle )
) {
$out->wrapWikiMsg(
"<div class='warningbox'>\n$1\n</div>\n",
# Is the title semi-protected?
if ( $this->oldTitle->isSemiProtected( 'move' ) ) {
$noticeMsg = 'semiprotectedpagemovewarning';
- $classes[] = 'mw-textarea-sprotected';
} else {
# Then it must be protected based on static groups (regular)
$noticeMsg = 'protectedpagemovewarning';
- $classes[] = 'mw-textarea-protected';
}
$out->addHTML( "<div class='mw-warning-with-logexcerpt'>\n" );
$out->addWikiMsg( $noticeMsg );
// mediawiki.special.movePage module
$immovableNamespaces = [];
+ $namespaceInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) {
- if ( !MediaWikiServices::getInstance()->getNamespaceInfo()->isMovable( $nsId ) ) {
+ if ( !$namespaceInfo->isMovable( $nsId ) ) {
$immovableNamespaces[] = $nsId;
}
}
- $handler = ContentHandler::getForTitle( $this->oldTitle );
-
$out->enableOOUI();
$fields = [];
}
if ( $user->isAllowed( 'suppressredirect' ) ) {
- if ( $handler->supportsRedirects() ) {
+ if ( $handlerSupportsRedirects ) {
$isChecked = $this->leaveRedirect;
$isDisabled = false;
} else {
'name' => 'wpMovesubpages',
'id' => 'wpMovesubpages',
'value' => '1',
- # Don't check the box if we only have talk subpages to
- # move and we aren't moving the talk page.
- 'selected' => $this->moveSubpages && ( $this->oldTitle->hasSubpages() || $this->moveTalk ),
+ 'selected' => true, // T222953 Always check the box
] ),
[
'label' => new OOUI\HtmlSnippet(
return;
}
+ $services = MediaWikiServices::getInstance();
+
# Show a warning if the target file exists on a shared repo
+ $repoGroup = $services->getRepoGroup();
if ( $nt->getNamespace() == NS_FILE
&& !( $this->moveOverShared && $user->isAllowed( 'reupload-shared' ) )
- && !RepoGroup::singleton()->getLocalRepo()->findFile( $nt )
- && MediaWikiServices::getInstance()->getRepoGroup()->findFile( $nt )
+ && !$repoGroup->getLocalRepo()->findFile( $nt )
+ && $repoGroup->findFile( $nt )
) {
$this->showForm( [ [ 'file-exists-sharedrepo' ] ] );
// Delete an associated image if there is
if ( $nt->getNamespace() == NS_FILE ) {
- $file = MediaWikiServices::getInstance()->getRepoGroup()->getLocalRepo()
- ->newFile( $nt );
+ $file = $repoGroup->getLocalRepo()->newFile( $nt );
$file->load( File::READ_LATEST );
if ( $file->exists() ) {
$file->delete( $reason, false, $user );
$this->moveTalk = false;
}
if ( $this->moveSubpages ) {
- $permissionManager = MediaWikiServices::getInstance()->getPermissionManager();
+ $permissionManager = $services->getPermissionManager();
$this->moveSubpages = $permissionManager->userCan( 'move-subpages', $user, $ot );
}
*/
// @todo FIXME: Use Title::moveSubpages() here
- $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo();
+ $nsInfo = $services->getNamespaceInfo();
$dbr = wfGetDB( DB_MASTER );
if ( $this->moveSubpages && (
$nsInfo->hasSubpages( $nt->getNamespace() ) || (
$mp = new MovePage( $oldSubpage, $newSubpage );
# This was copy-pasted from Renameuser, bleh.
- if ( $newSubpage->exists() && !$mp->isValidMove()->isOk() ) {
+ if ( $newSubpage->exists() && !$mp->isValidMove()->isOK() ) {
$link = $linkRenderer->makeKnownLink( $newSubpage );
$extraOutput[] = $this->msg( 'movepage-page-exists' )->rawParams( $link )->escaped();
} else {