r107515 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107514‎ | r107515 | r107516 >
Date:19:49, 28 December 2011
Author:ialex
Status:ok
Tags:
Comment:
* Use User::newFromName() instead of calling setName() on an existing object
* Some code cleanup
Modified paths:
  • /trunk/phase3/maintenance/cleanupCaps.php (modified) (history)
  • /trunk/phase3/maintenance/cleanupTable.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/cleanupTable.inc
@@ -43,7 +43,7 @@
4444
4545 public function execute() {
4646 global $wgUser;
47 - $wgUser->setName( 'Conversion script' );
 47+ $wgUser = User::newFromName( 'Conversion script' );
4848 $this->dryrun = $this->hasOption( 'dry-run' );
4949 if ( $this->dryrun ) {
5050 $this->output( "Checking for bad titles...\n" );
Index: trunk/phase3/maintenance/cleanupCaps.php
@@ -40,11 +40,15 @@
4141
4242 public function execute() {
4343 global $wgCapitalLinks, $wgUser;
 44+
 45+ if ( $wgCapitalLinks ) {
 46+ $this->error( "\$wgCapitalLinks is on -- no need for caps links cleanup.", true );
 47+ }
 48+
 49+ $wgUser = User::newFromName( 'Conversion script' );
 50+
4451 $this->namespace = intval( $this->getOption( 'namespace', 0 ) );
4552 $this->dryrun = $this->hasOption( 'dry-run' );
46 - $wgUser->setName( 'Conversion script' );
47 - if ( $wgCapitalLinks )
48 - $this->error( "\$wgCapitalLinks is on -- no need for caps links cleanup.", true );
4953
5054 $this->runTable( array(
5155 'table' => 'page',

Status & tagging log