From: Alexandre Emsenhuber Date: Wed, 28 Dec 2011 19:49:44 +0000 (+0000) Subject: * Use User::newFromName() instead of calling setName() on an existing object X-Git-Tag: 1.31.0-rc.0~25696 X-Git-Url: http://git.cyclocoop.org/%24image?a=commitdiff_plain;h=d5836e00e1f09dcf7031bf5af1cc3ce15818df0e;p=lhc%2Fweb%2Fwiklou.git * Use User::newFromName() instead of calling setName() on an existing object * Some code cleanup --- diff --git a/maintenance/cleanupCaps.php b/maintenance/cleanupCaps.php index d0539f5aec..6f8e180c89 100644 --- a/maintenance/cleanupCaps.php +++ b/maintenance/cleanupCaps.php @@ -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', diff --git a/maintenance/cleanupTable.inc b/maintenance/cleanupTable.inc index f63c6d743c..1c2797625c 100644 --- a/maintenance/cleanupTable.inc +++ b/maintenance/cleanupTable.inc @@ -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" );