X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FcleanupCaps.php;h=e0a0f494fb4aac0748f70a3edb750c1b476ba3a6;hb=3a5c66c7dd60dae10ad631336c6a7fea2bf41fe2;hp=9e88c13593ec27b0d32b190cfd6ad05e05b82b02;hpb=13e33c28983461d5b8bdc1dece0cd0a35347a261;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupCaps.php b/maintenance/cleanupCaps.php index 9e88c13593..e0a0f494fb 100644 --- a/maintenance/cleanupCaps.php +++ b/maintenance/cleanupCaps.php @@ -37,6 +37,9 @@ require_once __DIR__ . '/cleanupTable.inc'; * @ingroup Maintenance */ class CapsCleanup extends TableCleanup { + + private $user; + public function __construct() { parent::__construct(); $this->mDescription = "Script to cleanup capitalization"; @@ -44,13 +47,13 @@ class CapsCleanup extends TableCleanup { } public function execute() { - global $wgCapitalLinks, $wgUser; + global $wgCapitalLinks; if ( $wgCapitalLinks ) { $this->error( "\$wgCapitalLinks is on -- no need for caps links cleanup.", true ); } - $wgUser = User::newFromName( 'Conversion script' ); + $this->user = User::newSystemUser( 'Conversion script', array( 'steal' => true ) ); $this->namespace = intval( $this->getOption( 'namespace', 0 ) ); $this->dryrun = $this->hasOption( 'dry-run' ); @@ -87,7 +90,9 @@ class CapsCleanup extends TableCleanup { $this->output( "\"$display\" -> \"$targetDisplay\": DRY RUN, NOT MOVED\n" ); $ok = true; } else { - $ok = $current->moveTo( $target, false, 'Converting page titles to lowercase' ); + $mp = new MovePage( $current, $target ); + $status = $mp->move( $this->user, 'Converting page titles to lowercase', true ); + $ok = $status->isOK() ? 'OK' : $status->getWikiText(); $this->output( "\"$display\" -> \"$targetDisplay\": $ok\n" ); } if ( $ok === true ) {