* @ingroup Maintenance
*/
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/Maintenance.php';
/**
public function __construct() {
parent::__construct();
- $this->mDescription =
- "Convert from the old links schema (string->ID) to the new schema (ID->ID)."
- . "The wiki should be put into read-only mode while this script executes";
+ $this->addDescription(
+ 'Convert from the old links schema (string->ID) to the new schema (ID->ID). '
+ . 'The wiki should be put into read-only mode while this script executes' );
$this->addArg( 'logperformance', "Log performance to perfLogFilename.", false );
$this->addArg(
return;
}
- global $wgContLang;
-
# counters etc
$numBadLinks = $curRowsRead = 0;
$dbw->bufferResults( false );
$res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" );
- $ids = array();
+ $ids = [];
foreach ( $res as $row ) {
$title = $row->cur_title;
if ( $row->cur_namespace ) {
- $title = $wgContLang->getNsText( $row->cur_namespace ) . ":$title";
+ $title = MediaWikiServices::getInstance()->getContentLanguage()->
+ getNsText( $row->cur_namespace ) . ":$title";
}
$ids[$title] = $row->cur_id;
$curRowsRead++;
$sqlRead = $dbw->limitResult( $sqlRead, $linksConvInsertInterval, $rowOffset );
$res = $dbw->query( $sqlRead );
if ( $noKeys ) {
- $sqlWrite = array( "INSERT INTO $links_temp (l_from,l_to) VALUES " );
+ $sqlWrite = [ "INSERT INTO $links_temp (l_from,l_to) VALUES " ];
} else {
- $sqlWrite = array( "INSERT IGNORE INTO $links_temp (l_from,l_to) VALUES " );
+ $sqlWrite = [ "INSERT IGNORE INTO $links_temp (l_from,l_to) VALUES " ];
}
$tuplesAdded = 0; # no tuples added to INSERT yet
}
}
-$maintClass = "ConvertLinks";
+$maintClass = ConvertLinks::class;
require_once RUN_MAINTENANCE_IF_MAIN;