class RebuildInterwiki extends Maintenance {
public function __construct() {
parent::__construct();
- $this->mDescription = "Protect or unprotect an article from the command line.";
+ $this->mDescription = "Rebuild the interwiki table using the file on meta and the language list.";
$this->addOption( 'langlist', 'File with one language code per line', false, true );
$this->addOption( 'dblist', 'File with one db per line', false, true );
$this->addOption( 'd', 'Output folder', false, true );
# List of all database names
$this->dblist = array_map( "trim", file( $this->getOption( 'dblist', "/home/wikipedia/common/all.dblist" ) ) );
+ # Special-case databases
+ //$this->specials = array_flip( array_map( "trim", file( $this->getOption( 'specialdbs', "/home/wikipedia/common/special.dblist" ) ) ) );
+
$this->makeInterwikiSQL( $this->getOption( 'd', '/home/wikipedia/conf/interwiki/sql' ) );
}
);
# Special-case hostnames
- $specials = array(
+ $this->specials = array(
'sourceswiki' => 'sources.wikipedia.org',
'quotewiki' => 'wikiquote.org',
'textbookwiki' => 'wikibooks.org',
$lines = array_map( 'trim', explode( "\n", trim( $intermap ) ) );
if ( !$lines || count( $lines ) < 2 ) {
- wfDie( "m:Interwiki_map not found" );
+ $this->error( "m:Interwiki_map not found", true );
}
$iwArray = array();
foreach ( $this->dblist as $db ) {
$sql = "-- Generated by rebuildInterwiki.php";
- if ( isset( $specials[$db] ) ) {
+ if ( isset( $this->specials[$db] ) ) {
# Special wiki
# Has interwiki links and interlanguage links to wikipedia
- $host = $specials[$db];
+ $host = $this->specials[$db];
$sql .= "\n--$host\n\n";
$sql .= "USE $db;\n" .
"TRUNCATE TABLE interwiki;\n" .