Merge "Made wfThumbIsStandard() aware of the width/height handler scaling choice"
[lhc/web/wiklou.git] / maintenance / cleanupCaps.php
index d0539f5..9e88c13 100644 (file)
@@ -1,13 +1,13 @@
 <?php
 /**
- * Script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ * Clean up broken page links when somebody turns on $wgCapitalLinks.
  *
  * Usage: php cleanupCaps.php [--dry-run]
  * Options:
  *   --dry-run  don't actually try moving them
  *
  * Copyright © 2005 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * @ingroup Maintenance
  */
 
-require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
+require_once __DIR__ . '/cleanupTable.inc';
 
+/**
+ * Maintenance script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ *
+ * @ingroup Maintenance
+ */
 class CapsCleanup extends TableCleanup {
        public function __construct() {
                parent::__construct();
@@ -40,11 +45,15 @@ class CapsCleanup extends TableCleanup {
 
        public function execute() {
                global $wgCapitalLinks, $wgUser;
+
+               if ( $wgCapitalLinks ) {
+                       $this->error( "\$wgCapitalLinks is on -- no need for caps links cleanup.", true );
+               }
+
+               $wgUser = User::newFromName( 'Conversion script' );
+
                $this->namespace = intval( $this->getOption( 'namespace', 0 ) );
                $this->dryrun = $this->hasOption( 'dry-run' );
-               $wgUser->setName( 'Conversion script' );
-               if ( $wgCapitalLinks )
-                       $this->error( "\$wgCapitalLinks is on -- no need for caps links cleanup.", true );
 
                $this->runTable( array(
                        'table' => 'page',
@@ -62,6 +71,7 @@ class CapsCleanup extends TableCleanup {
                $lower = $wgContLang->lcfirst( $row->page_title );
                if ( $upper == $lower ) {
                        $this->output( "\"$display\" already lowercase.\n" );
+
                        return $this->progress( 0 );
                }
 
@@ -69,6 +79,7 @@ class CapsCleanup extends TableCleanup {
                $targetDisplay = $target->getPrefixedText();
                if ( $target->exists() ) {
                        $this->output( "\"$display\" skipped; \"$targetDisplay\" already exists\n" );
+
                        return $this->progress( 0 );
                }
 
@@ -89,9 +100,10 @@ class CapsCleanup extends TableCleanup {
                                }
                        }
                }
+
                return $this->progress( 0 );
        }
 }
 
 $maintClass = "CapsCleanup";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;