From d5836e00e1f09dcf7031bf5af1cc3ce15818df0e Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Wed, 28 Dec 2011 19:49:44 +0000 Subject: [PATCH] * Use User::newFromName() instead of calling setName() on an existing object * Some code cleanup --- maintenance/cleanupCaps.php | 10 +++++++--- maintenance/cleanupTable.inc | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) 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" ); -- 2.20.1