* Rebuild interwiki table using the file on meta and the language list
* Wikimedia specific!
*
+ * @file
* @todo document
- * @package MediaWiki
- * @subpackage Maintenance
+ * @ingroup Maintenance
*/
-/** */
-
/**
* @todo document
- * @package MediaWiki
- * @subpackage Maintenance
+ * @ingroup Maintenance
*/
class Site {
var $suffix, $lateral, $url;
- function Site( $s, $l, $u ) {
+ function __construct( $s, $l, $u ) {
$this->suffix = $s;
$this->lateral = $l;
$this->url = $u;
}
function getRebuildInterwikiDump() {
- global $langlist, $languageAliases, $prefixRewrites, $wgDBname;
+ global $langlist, $languageAliases, $prefixRewrites;
# Multi-language sites
# db suffix => db suffix, iw prefix, hostname
# List of all database names
$dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) );
- # Special-case hostnames
- $specials = array(
- 'sourceswiki' => 'sources.wikipedia.org',
- 'quotewiki' => 'wikiquote.org',
- 'textbookwiki' => 'wikibooks.org',
- 'sep11wiki' => 'sep11.wikipedia.org',
- 'metawiki' => 'meta.wikimedia.org',
- 'commonswiki' => 'commons.wikimedia.org',
- );
+ # Special-case databases
+ $specials = array_flip(
+ array_map( "trim",
+ file( "/home/wikipedia/common/special.dblist" ) ) );
# Extra interwiki links that can't be in the intermap for some reason
$extraLinks = array(
}
# Extract the intermap from meta
- $intermap = wfGetHTTP( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw', 30 );
+ $intermap = Http::get( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw', 30 );
$lines = array_map( 'trim', explode( "\n", trim( $intermap ) ) );
if ( !$lines || count( $lines ) < 2 ) {
wfDie( "m:Interwiki_map not found" );
}
- $iwArray = array();
- # Global iterwiki map
+ # Global iterwiki map
foreach ( $lines as $line ) {
if ( preg_match( '/^\|\s*(.*?)\s*\|\|\s*(.*?)\s*$/', $line, $matches ) ) {
$prefix = strtolower( $matches[1] );
#Multilanguage sites
foreach ($sites as $site)
- $sql .= makeLanguageLinks ( $site, "_".$site->suffix );
+ makeLanguageLinks ( $site, "_".$site->suffix );
foreach ( $dblist as $db ) {
continue;
}
$lang = $matches[1];
- $host = "$lang." . $site->url;
# Lateral links
foreach ( $sites as $targetSite ) {
# ------------------------------------------------------------------------------------------
-# Returns part of an INSERT statement, corresponding to all interlanguage links to a particular site
+# Executes part of an INSERT statement, corresponding to all interlanguage links to a particular site
function makeLanguageLinks( &$site, $source ) {
global $langlist, $languageAliases;
# Actual languages with their own databases
print "{$source}:{$entry['iw_prefix']} {$entry['iw_url']} {$entry['iw_local']}\n";
}
-
-?>