-<?
-
-# Rebuild interwiki table using the file on meta and the language list
-# Wikimedia specific!
+<?php
+/**
+ * Rebuild interwiki table using the file on meta and the language list
+ * Wikimedia specific!
+ *
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
+
+/** */
$oldCwd = getcwd();
$optionsWithArgs = array( "o" );
include_once( "commandLine.inc" );
+/**
+ * @todo document
+ * @package MediaWiki
+ * @subpackage Maintenance
+ */
class Site {
var $suffix, $lateral, $url;
$sites = array(
'wiki' => new Site( 'wiki', 'w', 'wikipedia.org' ),
'wiktionary' => new Site( 'wiktionary', 'wikt', 'wiktionary.org' ),
- 'wikiquote' => new Site( 'wikiquote', 'wikiquote', 'wikiquote.org' ),
- 'wikibooks' => new Site( 'wikibooks', 'wikibooks', 'wikibooks.org' )
+ 'wikiquote' => new Site( 'wikiquote', 'q', 'wikiquote.org' ),
+ 'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' )
);
$langlist = array_map( "trim", file( "/home/wikipedia/common/langlist" ) );
$dblist = array_map( "trim", file( "/home/wikipedia/common/all.dblist" ) );
$languageAliases = array(
'zh-cn' => 'zh',
'zh-tw' => 'zh',
+ 'dk' => 'da',
);
# Construct a list of reserved prefixes
# Extract the intermap from meta
$dbr =& wfGetDB( DB_WRITE );
- $row = $dbr->getArray( "metawiki.cur", array( "cur_text" ),
+ $row = $dbr->selectRow( "metawiki.cur", array( "cur_text" ),
array( "cur_namespace" => 0, "cur_title" => "Interwiki_map" ) );
if ( !$row ) {
# Extra links
foreach ( $extraLinks as $link ) {
- $sql .= makeLink( $link, $first );
+ $sql .= makeLink( $link, $first );
}
$sql .= ";\n";
# Intermap links
foreach ( $iwArray as $iwEntry ) {
- $sql .= makeLink( $iwEntry, $first );
+ # Suppress links with the same name as the site
+ if ( ( $suffix == 'wiki' && $iwEntry['iw_prefix'] != 'wikipedia' ) ||
+ ( $suffix != 'wiki' && $suffix != $iwEntry['iw_prefix'] ) )
+ {
+ $sql .= makeLink( $iwEntry, $first );
+ }
}
# Lateral links