* Use User::newFromName() instead of calling setName() on an existing object
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 28 Dec 2011 19:49:44 +0000 (19:49 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Wed, 28 Dec 2011 19:49:44 +0000 (19:49 +0000)
* Some code cleanup

maintenance/cleanupCaps.php
maintenance/cleanupTable.inc

index d0539f5..6f8e180 100644 (file)
@@ -40,11 +40,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',
index f63c6d7..1c27976 100644 (file)
@@ -43,7 +43,7 @@ class TableCleanup extends Maintenance {
 
        public function execute() {
                global $wgUser;
-               $wgUser->setName( 'Conversion script' );
+               $wgUser = User::newFromName( 'Conversion script' );
                $this->dryrun = $this->hasOption( 'dry-run' );
                if ( $this->dryrun ) {
                        $this->output( "Checking for bad titles...\n" );