And we now have CSSMin
[lhc/web/wiklou.git] / maintenance / rebuildInterwiki.php
index c715597..6732db2 100644 (file)
@@ -33,7 +33,7 @@ require_once( dirname( __FILE__ ) . '/Maintenance.php' );
 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 );
@@ -46,6 +46,9 @@ class RebuildInterwiki extends Maintenance {
                # 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' ) );
        }
 
@@ -66,7 +69,7 @@ class RebuildInterwiki extends Maintenance {
                );
 
                # Special-case hostnames
-               $specials = array(
+               $this->specials = array(
                        'sourceswiki' => 'sources.wikipedia.org',
                        'quotewiki' => 'wikiquote.org',
                        'textbookwiki' => 'wikibooks.org',
@@ -117,7 +120,7 @@ class RebuildInterwiki extends Maintenance {
                $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();
@@ -141,11 +144,11 @@ class RebuildInterwiki extends Maintenance {
 
                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" .