Fix SQLite patch-(page|template)links-fix-pk.sql column order
[lhc/web/wiklou.git] / maintenance / cleanupCaps.php
index 546825b..20be9fd 100644 (file)
@@ -29,6 +29,8 @@
  * @ingroup Maintenance
  */
 
+use MediaWiki\MediaWikiServices;
+
 require_once __DIR__ . '/cleanupTable.inc';
 
 /**
@@ -37,7 +39,7 @@ require_once __DIR__ . '/cleanupTable.inc';
  *
  * @ingroup Maintenance
  */
-class CapsCleanup extends TableCleanup {
+class CleanupCaps extends TableCleanup {
 
        private $user;
        private $namespace;
@@ -53,7 +55,10 @@ class CapsCleanup extends TableCleanup {
 
                $this->namespace = intval( $this->getOption( 'namespace', 0 ) );
 
-               if ( MWNamespace::isCapitalized( $this->namespace ) ) {
+               if (
+                       MediaWikiServices::getInstance()->getNamespaceInfo()->
+                               isCapitalized( $this->namespace )
+               ) {
                        $this->output( "Will be moving pages to first letter capitalized titles" );
                        $callback = 'processRowToUppercase';
                } else {
@@ -71,12 +76,10 @@ class CapsCleanup extends TableCleanup {
        }
 
        protected function processRowToUppercase( $row ) {
-               global $wgContLang;
-
                $current = Title::makeTitle( $row->page_namespace, $row->page_title );
                $display = $current->getPrefixedText();
                $lower = $row->page_title;
-               $upper = $wgContLang->ucfirst( $row->page_title );
+               $upper = MediaWikiServices::getInstance()->getContentLanguage()->ucfirst( $row->page_title );
                if ( $upper == $lower ) {
                        $this->output( "\"$display\" already uppercase.\n" );
 
@@ -86,7 +89,7 @@ class CapsCleanup extends TableCleanup {
                $target = Title::makeTitle( $row->page_namespace, $upper );
                if ( $target->exists() ) {
                        // Prefix "CapsCleanup" to bypass the conflict
-                       $target = Title::newFromText( __CLASS__ . '/' . $display );
+                       $target = Title::newFromText( 'CapsCleanup/' . $display );
                }
                $ok = $this->movePage(
                        $current,
@@ -109,12 +112,10 @@ class CapsCleanup extends TableCleanup {
        }
 
        protected function processRowToLowercase( $row ) {
-               global $wgContLang;
-
                $current = Title::makeTitle( $row->page_namespace, $row->page_title );
                $display = $current->getPrefixedText();
                $upper = $row->page_title;
-               $lower = $wgContLang->lcfirst( $row->page_title );
+               $lower = MediaWikiServices::getInstance()->getContentLanguage()->lcfirst( $row->page_title );
                if ( $upper == $lower ) {
                        $this->output( "\"$display\" already lowercase.\n" );
 
@@ -169,5 +170,5 @@ class CapsCleanup extends TableCleanup {
        }
 }
 
-$maintClass = CapsCleanup::class;
+$maintClass = CleanupCaps::class;
 require_once RUN_MAINTENANCE_IF_MAIN;