X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FnamespaceDupes.php;h=3c73306eb616efc64e9d882c3e06d8469ab79448;hb=5ed6917b4a630ef5b9d9d9ea68c2f4043cb70f1e;hp=71241e70335dc7e5debc3ca5b7e2e09a33cca61f;hpb=6bfa7c37540da7605e88c10caf0295ae8ff45723;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/namespaceDupes.php b/maintenance/namespaceDupes.php index 71241e7033..3c73306eb6 100644 --- a/maintenance/namespaceDupes.php +++ b/maintenance/namespaceDupes.php @@ -104,25 +104,29 @@ class NamespaceDupes extends Maintenance { * @return bool */ private function checkAll( $options ) { - global $wgContLang, $wgNamespaceAliases, $wgCapitalLinks; + global $wgNamespaceAliases, $wgCapitalLinks; + $contLang = MediaWikiServices::getInstance()->getContentLanguage(); $spaces = []; // List interwikis first, so they'll be overridden // by any conflicting local namespaces. foreach ( $this->getInterwikiList() as $prefix ) { - $name = $wgContLang->ucfirst( $prefix ); + $name = $contLang->ucfirst( $prefix ); $spaces[$name] = 0; } // Now pull in all canonical and alias namespaces... - foreach ( MWNamespace::getCanonicalNamespaces() as $ns => $name ) { + foreach ( + MediaWikiServices::getInstance()->getNamespaceInfo()->getCanonicalNamespaces() + as $ns => $name + ) { // This includes $wgExtraNamespaces if ( $name !== '' ) { $spaces[$name] = $ns; } } - foreach ( $wgContLang->getNamespaces() as $ns => $name ) { + foreach ( $contLang->getNamespaces() as $ns => $name ) { if ( $name !== '' ) { $spaces[$name] = $ns; } @@ -130,7 +134,7 @@ class NamespaceDupes extends Maintenance { foreach ( $wgNamespaceAliases as $name => $ns ) { $spaces[$name] = $ns; } - foreach ( $wgContLang->getNamespaceAliases() as $name => $ns ) { + foreach ( $contLang->getNamespaceAliases() as $name => $ns ) { $spaces[$name] = $ns; } @@ -138,17 +142,17 @@ class NamespaceDupes extends Maintenance { // since we're doing case-sensitive searches in the db. foreach ( $spaces as $name => $ns ) { $moreNames = []; - $moreNames[] = $wgContLang->uc( $name ); - $moreNames[] = $wgContLang->ucfirst( $wgContLang->lc( $name ) ); - $moreNames[] = $wgContLang->ucwords( $name ); - $moreNames[] = $wgContLang->ucwords( $wgContLang->lc( $name ) ); - $moreNames[] = $wgContLang->ucwordbreaks( $name ); - $moreNames[] = $wgContLang->ucwordbreaks( $wgContLang->lc( $name ) ); + $moreNames[] = $contLang->uc( $name ); + $moreNames[] = $contLang->ucfirst( $contLang->lc( $name ) ); + $moreNames[] = $contLang->ucwords( $name ); + $moreNames[] = $contLang->ucwords( $contLang->lc( $name ) ); + $moreNames[] = $contLang->ucwordbreaks( $name ); + $moreNames[] = $contLang->ucwordbreaks( $contLang->lc( $name ) ); if ( !$wgCapitalLinks ) { foreach ( $moreNames as $altName ) { - $moreNames[] = $wgContLang->lcfirst( $altName ); + $moreNames[] = $contLang->lcfirst( $altName ); } - $moreNames[] = $wgContLang->lcfirst( $name ); + $moreNames[] = $contLang->lcfirst( $name ); } foreach ( array_unique( $moreNames ) as $altName ) { if ( $altName !== $name ) { @@ -428,7 +432,10 @@ class NamespaceDupes extends Maintenance { * @return ResultWrapper */ private function getTargetList( $ns, $name, $options ) { - if ( $options['move-talk'] && MWNamespace::isSubject( $ns ) ) { + if ( + $options['move-talk'] && + MediaWikiServices::getInstance()->getNamespaceInfo()->isSubject( $ns ) + ) { $checkNamespaces = [ NS_MAIN, NS_TALK ]; } else { $checkNamespaces = NS_MAIN; @@ -464,9 +471,10 @@ class NamespaceDupes extends Maintenance { $dbk = "$name-" . $dbk; } $destNS = $ns; - if ( $sourceNs == NS_TALK && MWNamespace::isSubject( $ns ) ) { + $nsInfo = MediaWikiServices::getInstance()->getNamespaceInfo(); + if ( $sourceNs == NS_TALK && $nsInfo->isSubject( $ns ) ) { // This is an associated talk page moved with the --move-talk feature. - $destNS = MWNamespace::getTalk( $destNS ); + $destNS = $nsInfo->getTalk( $destNS ); } $newTitle = Title::makeTitleSafe( $destNS, $dbk ); if ( !$newTitle || !$newTitle->canExist() ) {