<?php
/**
- * Script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ * Clean up broken page links when somebody turns on $wgCapitalLinks.
*
* Usage: php cleanupCaps.php [--dry-run]
* Options:
* --dry-run don't actually try moving them
*
* Copyright © 2005 Brion Vibber <brion@pobox.com>
- * http://www.mediawiki.org/
+ * https://www.mediawiki.org/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* @ingroup Maintenance
*/
-require_once( dirname( __FILE__ ) . '/cleanupTable.inc' );
+require_once __DIR__ . '/cleanupTable.inc';
+/**
+ * Maintenance script to clean up broken page links when somebody turns on $wgCapitalLinks.
+ *
+ * @ingroup Maintenance
+ */
class CapsCleanup extends TableCleanup {
public function __construct() {
parent::__construct();
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',
$lower = $wgContLang->lcfirst( $row->page_title );
if ( $upper == $lower ) {
$this->output( "\"$display\" already lowercase.\n" );
+
return $this->progress( 0 );
}
$targetDisplay = $target->getPrefixedText();
if ( $target->exists() ) {
$this->output( "\"$display\" skipped; \"$targetDisplay\" already exists\n" );
+
return $this->progress( 0 );
}
}
}
}
+
return $this->progress( 0 );
}
}
$maintClass = "CapsCleanup";
-require_once( RUN_MAINTENANCE_IF_MAIN );
+require_once RUN_MAINTENANCE_IF_MAIN;