* (bug 3722) Update of Arabic language (ar) Namespace changes
* Wrap message page insertions in a transaction to speed up installation
* Avoid notice warning on edit with no User-Agent header
+* Various fixes
=== Caveats ===
function deleteIfExpired()
{
+ $fname = 'Block::deleteIfExpired';
+ wfProfileIn( $fname );
if ( $this->isExpired() ) {
wfDebug( "Block::deleteIfExpired() -- deleting\n" );
$this->delete();
- return true;
+ $retVal = true;
} else {
wfDebug( "Block::deleteIfExpired() -- not expired\n" );
- return false;
+ $retVal = false;
}
+ wfProfileOut( $fname );
+ return $retVal;
}
function isExpired()
if ( $wgProfiling ) {
# generalizeSQL will probably cut down the query to reasonable
# logging size most of the time. The substr is really just a sanity check.
- $profName = 'query: ' . $fname . ' ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+
+ # Who's been wasting my precious column space? -- TS
+ #$profName = 'query: ' . $fname . ' ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+ $profName = 'query: ' . substr( Database::generalizeSQL( $sql ), 0, 255 );
+
wfProfileIn( 'Database::query' );
wfProfileIn( $profName );
}
$wgDisableCounters = false;
$wgDisableTextSearch = false;
+$wgDisableSearchContext = false;
/**
* If you've disabled search semi-permanently, this also disables updates to the
* table. If you ever re-enable, be sure to rebuild the search table.
$fname = 'EditPage::edit';
wfProfileIn( $fname );
+ wfDebug( "$fname: enter\n" );
// this is not an article
$wgOut->setArticleFlag(false);
}
if ( ! $this->mTitle->userCanEdit() ) {
+ wfDebug( "$fname: user can't edit\n" );
$wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
wfProfileOut( $fname );
return;
}
+ wfDebug( "$fname: Checking blocks\n" );
if ( !$this->preview && !$this->diff && $wgUser->isBlockedFrom( $this->mTitle, !$this->save ) ) {
# When previewing, don't check blocked state - will get caught at save time.
# Also, check when starting edition is done against slave to improve performance.
+ wfDebug( "$fname: user is blocked\n" );
$this->blockedIPpage();
wfProfileOut( $fname );
return;
}
if ( !$wgUser->isAllowed('edit') ) {
if ( $wgUser->isAnon() ) {
+ wfDebug( "$fname: user must log in\n" );
$this->userNotLoggedInPage();
wfProfileOut( $fname );
return;
} else {
+ wfDebug( "$fname: read-only page\n" );
$wgOut->readOnlyPage( $this->mArticle->getContent( true ), true );
wfProfileOut( $fname );
return;
}
}
if ( wfReadOnly() ) {
+ wfDebug( "$fname: read-only mode is engaged\n" );
if( $this->save || $this->preview ) {
$this->formtype = 'preview';
} else if ( $this->diff ) {
$this->starttime = $request->getVal( 'wpStarttime' );
if( is_null( $this->edittime ) ) {
# If the form is incomplete, force to preview.
+ wfDebug( "$fname: Form data appears to be incomplete\n" );
+ wfDebug( "POST DATA: " . var_export( $_POST, true ) . "\n" );
$this->preview = true;
} else {
if( $this->tokenOk( $request ) ) {
# if the user hits enter in the comment box.
# The unmarked state will be assumed to be a save,
# if the form seems otherwise complete.
+ wfDebug( "$fname: Passed token check.\n" );
$this->preview = $request->getCheck( 'wpPreview' );
$this->diff = $request->getCheck( 'wpDiff' );
} else {
# Page might be a hack attempt posted from
# an external site. Preview instead of saving.
+ wfDebug( "$fname: Failed token check; forcing preview\n" );
$this->preview = true;
}
}
$this->watchthis = $request->getCheck( 'wpWatchthis' );
} else {
# Not a posted form? Start with nothing.
+ wfDebug( "$fname: Not a posted form.\n" );
$this->textbox1 = '';
$this->textbox2 = '';
$this->mMetaData = '';
# Don't thumbnail an image so big that it will fill hard drives and send servers into swap
# JPEG has the handy property of allowing thumbnailing without full decompression, so we make
# an exception for it.
- if ( $this->getMimeType() !== "image/jpeg" && $this->width * $this->height > $wgMaxImageArea ) {
+ if ( $this->getMediaType() == MEDIATYPE_BITMAP &&
+ $this->getMimeType() !== 'image/jpeg' &&
+ $this->width * $this->height > $wgMaxImageArea )
+ {
wfProfileOut( $fname );
return null;
}
if ( 0 != $id ) { return $id; }
$fname = 'LinkCache::addLinkObj';
+ global $wgProfiler;
+ if ( isset( $wgProfiler ) ) {
+ $fname .= ' (' . $wgProfiler->getCurrentSection() . ')';
+ }
+
wfProfileIn( $fname );
$ns = $nt->getNamespace();
* Results are cached for a short time in memcached
*/
function getLagTimes() {
+ global $wgDBname;
+
$expiry = 5;
$requestRate = 10;
global $wgMemc;
- $times = $wgMemc->get( 'lag_times' );
+ $times = $wgMemc->get( "$wgDBname:lag_times" );
if ( $times ) {
# Randomly recache with probability rising over $expiry
$elapsed = time() - $times['timestamp'];
# Add a timestamp key so we know when it was cached
$times['timestamp'] = time();
- $wgMemc->set( 'lag_times', $times, $expiry );
+ $wgMemc->set( "$wgDBname:lag_times", $times, $expiry );
# But don't give the timestamp to the caller
unset($times['timestamp']);
wfSuppressWarnings();
$message = $lang->getMessage( $key );
wfRestoreWarnings();
+ if ( is_null( $message ) ) {
+ $message = false;
+ }
}
# Try the English array
wfSuppressWarnings();
$message = Language::getMessage( $key );
wfRestoreWarnings();
+ if ( is_null( $message ) ) {
+ $message = false;
+ }
}
# Is this a custom message? Try the default language in the db...
$calls = $this->mCalls[$fname];
$percent = $total ? 100. * $elapsed / $total : 0;
$memory = $this->mMemory[$fname];
- $prof .= sprintf($format, $fname, $calls, (float) ($elapsed * 1000), (float) ($elapsed * 1000) / $calls, $percent, $memory, ($this->mMin[$fname] * 1000.0), ($this->mMax[$fname] * 1000.0), $this->mOverhead[$fname]);
+ $prof .= sprintf($format, substr($fname, 0, $nameWidth), $calls, (float) ($elapsed * 1000), (float) ($elapsed * 1000) / $calls, $percent, $memory, ($this->mMin[$fname] * 1000.0), ($this->mMax[$fname] * 1000.0), $this->mOverhead[$fname]);
global $wgProfileToDatabase;
if ($wgProfileToDatabase) {
* @static
*/
function logToDB($name, $timeSum, $eventCount) {
+ # Warning: $wguname is a live patch, it should be moved to Setup.php
+ global $wguname;
+
$fname = 'Profiler::logToDB';
$dbw = & wfGetDB(DB_MASTER);
$profiling = $dbw->tableName('profiling');
$name = substr($name, 0, 255);
$encname = $dbw->strencode($name);
- $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} "."WHERE pf_name='{$encname}'";
+ $sql = "UPDATE $profiling "."SET pf_count=pf_count+{$eventCount}, "."pf_time=pf_time + {$timeSum} ".
+ "WHERE pf_name='{$encname}' AND pf_server='{$wguname['nodename']}'";
$dbw->query($sql);
$rc = $dbw->affectedRows();
if ($rc == 0) {
- $dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount, 'pf_time' => $timeSum), $fname, array ('IGNORE'));
+ $dbw->insert('profiling', array ('pf_name' => $name, 'pf_count' => $eventCount,
+ 'pf_time' => $timeSum, 'pf_server' => $wguname['nodename'] ), $fname, array ('IGNORE'));
}
// When we upgrade to mysql 4.1, the insert+update
// can be merged into just a insert with this construct added:
// "pf_time=pf_time + VALUES(pf_time)";
}
+ /**
+ * Get the function name of the current profiling section
+ */
+ function getCurrentSection() {
+ $elt =& end($this->mWorkStack);
+ return $elt[0];
+ }
+
}
$wgProfiler = new Profiler();
);
}
+ /**
+ * Make URL details where the article exists (or at least it's convenient to think so)
+ */
+ function makeKnownUrlDetails( $name, $urlaction='' ) {
+ $title = Title::newFromText( $name );
+ $this->checkTitle($title, $name);
+ return array(
+ 'href' => $title->getLocalURL( $urlaction ),
+ 'exists' => true
+ );
+ }
+
# make sure we have some title to operate on
/*static*/ function checkTitle ( &$title, &$name ) {
if(!is_object($title)) {
$this->username = $wgUser->getName();
$userPage = $wgUser->getUserPage();
$this->userpage = $userPage->getPrefixedText();
- $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage);
+
+ if ( $wgUser->isLoggedIn() || $this->showIPinHeader() ) {
+ $this->userpageUrlDetails = $this->makeUrlDetails($this->userpage);
+ } else {
+ # This won't be used in the standard skins, but we define it to preserve the interface
+ # To save time, we check for existence
+ $this->userpageUrlDetails = $this->makeKnownUrlDetails($this->userpage);
+ }
$this->usercss = $this->userjs = $this->userjsprev = false;
$this->setupUserCss();
return $personal_urls;
}
+ /**
+ * Returns true if the IP should be shown in the header
+ */
+ function showIPinHeader() {
+ global $wgShowIPinHeader;
+ return $wgShowIPinHeader && isset( $_COOKIE[ini_get("session.name")] );
+ }
function tabAction( $title, $message, $selected, $query='', $checkEdit=false ) {
$classes = array();
}
}
}
+
+ # Extensions
+ wfRunHooks( 'GetBlockedStatus', array( &$this ) );
+
wfProfileOut( $fname );
}
}
function isAllowedToCreateAccount() {
- return $this->isAllowed( 'createaccount' );
+ return $this->isAllowed( 'createaccount' ) && !$this->isBlocked();
}
/**
*
* @return bool false on failure, true on success
*/
+ /*
function _safe_fwrite($f, $buf, $len = false) {
stream_set_blocking($f, 0);
if ($len === false) {
+ wfDebug("Writing " . strlen( $buf ) . " bytes\n");
$bytesWritten = fwrite($f, $buf);
} else {
+ wfDebug("Writing $len bytes\n");
$bytesWritten = fwrite($f, $buf, $len);
}
- $n = stream_select($r=NULL, $w = array($f), $e = NULL,
- $this->_timeout_seconds, $this->_timeout_microseconds);
+ $n = stream_select($r=NULL, $w = array($f), $e = NULL, 10, 0);
+ # $this->_timeout_seconds, $this->_timeout_microseconds);
+ wfDebug("stream_select returned $n\n");
stream_set_blocking($f, 1);
return $n == 1;
+ return $bytesWritten;
+ }*/
+
+ /**
+ * Original behaviour
+ */
+ function _safe_fwrite($f, $buf, $len = false) {
+ if ($len === false) {
+ $bytesWritten = fwrite($f, $buf);
+ } else {
+ $bytesWritten = fwrite($f, $buf, $len);
+ }
+ return $bytesWritten;
}
/**
/* check variant links so that interwiki links don't have to worry about
the possible different language variants
*/
- if( !is_null($wgTitle) && $wgTitle->getArticleID() == 0 )
+ if( count($wgContLang->getVariants()) > 1 && !is_null($wgTitle) && $wgTitle->getArticleID() == 0 )
$wgContLang->findVariantLink( $title, $wgTitle );
}
* @access private
*/
function log( $message ) {
- echo wfTimestamp( TS_DB ) . ': ' . $message . "\n";
+ global $wgDBname;
+ echo $wgDBname . ' ' . wfTimestamp( TS_DB ) . ': ' . $message . "\n";
flush();
}
require_once( 'FiveUpgrade.inc' );
class CapsCleanup extends FiveUpgrade {
- function CapsCleanup( $dryrun = false ) {
+ function CapsCleanup( $dryrun = false, $namespace=0 ) {
parent::FiveUpgrade();
$this->maxLag = 10; # if slaves are lagged more than 10 secs, wait
$this->dryrun = $dryrun;
+ $this->namespace = intval( $namespace );
}
function cleanup() {
return false;
}
- $this->runTable( 'page', 'WHERE page_namespace=0',
+ $this->runTable( 'page', 'WHERE page_namespace=' . $this->namespace,
array( &$this, 'processPage' ) );
}
if( $ok === true ) {
$this->progress( 1 );
- if( $row->page_namespace == NS_MAIN ) {
- $talk = Title::makeTitle( NS_TALK, $row->page_title );
+ if( $row->page_namespace == $this->namespace ) {
+ $talk = $target->getTalkPage();
$xrow = $row;
- $row->page_namespace = NS_TALK;
+ $row->page_namespace = $talk->getNamespace();
if( $talk->exists() ) {
return $this->processPage( $row );
}
}
$wgUser->setName( 'Conversion script' );
-$caps = new CapsCleanup( isset( $options['dry-run'] ) );
+$ns = isset( $options['namespace'] ) ? $options['namespace'] : 0;
+$caps = new CapsCleanup( isset( $options['dry-run'] ), $ns );
$caps->cleanup();
?>
/** */
require_once('commandLine.inc');
+$dbr =& wfGetDB( DB_SLAVE );
+$res = $dbr->select( 'interwiki', array( 'iw_prefix' ), false );
+$prefixes = array();
+while ( $row = $dbr->fetchObject( $res ) ) {
+ $prefixes[] = $row->iw_prefix;
+}
+
foreach ( $wgLocalDatabases as $db ) {
print "$db ";
- foreach ( $wgLanguageNamesEn as $prefix => $name ) {
+ foreach ( $prefixes as $prefix ) {
$wgMemc->delete("$db:interwiki:$prefix");
}
}
print "\n";
-?>
\ No newline at end of file
+?>
require_once( "$IP/includes/Defines.php" );
require_once( "$IP/CommonSettings.php" );
- if ( !$wgUseNormalUser ) {
+ if ( $wgUseRootUser ) {
+ $wgDBuser = $wgDBadminuser = "root";
+ $wgDBpassword = $wgDBadminpassword = trim(`mysql_root_pass`);
+ } elseif ( !$wgUseNormalUser ) {
$wgDBuser = $wgDBadminuser = "wikiadmin";
$wgDBpassword = $wgDBadminpassword = trim(`wikiadmin_pass`);
}
}
}
+if ( defined( 'MW_CMDLINE_CALLBACK' ) ) {
+ $fn = MW_CMDLINE_CALLBACK;
+ $fn();
+}
+
ini_set( 'memory_limit', -1 );
require_once( "Setup.php" );
<?php
-// php deleteImageMemcached.php --until "2003-09-04 04:40:00" --wait 500
+// php deleteImageMemcached.php --until "2005-09-05 00:00:00" --sleep 0 --report 10
$optionsWithArgs = array( 'until', 'sleep', 'report' );
require_once 'commandLine.inc';
function main() {
global $wgMemc, $wgDBname;
$fname = 'DeleteImageCache::main';
+
+ ini_set( 'display_errors', false );
$dbr =& wfGetDB( DB_SLAVE );
global $wgUploadPath, $wgLogo, $wgMaxCredits, $wgSharedUploadPath;
global $wgHideInterlanguageLinks, $wgUploadDirectory, $wgThumbnailScriptPath;
global $wgSharedThumbnailScriptPath, $wgEnableParserCache, $wgHooks, $wgServer;
- global $wgRightsUrl, $wgRightsText;
+ global $wgRightsUrl, $wgRightsText, $wgCopyrightIcon;
static $oldLogo = NULL;
$wgLogo = $wgScriptPath . $wgLogo;
}
+ # Another ugly hack
+ $wgCopyrightIcon = str_replace( 'src="/images',
+ 'src="' . htmlspecialchars( $wgScriptPath ) . '/images', $wgCopyrightIcon );
+
+
+
$wgStylePath = "$wgScriptPath/skins";
$wgUploadPath = "$wgScriptPath/{$this->imageRel}";
$wgSharedUploadPath = "$wgUploadPath/shared";
$wgForceLoadBalancing = (getenv('MW_BALANCE') ? true : false);
$wgUseNormalUser = (getenv('MW_WIKIUSER') ? true : false);
+if (getenv('MW_PROFILING')) {
+ define('MW_CMDLINE_CALLBACK', 'wfSetProfiling');
+}
+function wfSetProfiling() { $GLOBALS['wgProfiling'] = true; }
+
+$optionsWithArgs = array( 'd' );
/** */
require_once( "commandLine.inc" );
+if ( isset( $options['d'] ) ) {
+ $d = $options['d'];
+ if ( $d > 0 ) {
+ $wgDebugLogFile = '/dev/stdout';
+ }
+ if ( $d > 1 ) {
+ foreach ( $wgLoadBalancer->mServers as $i => $server ) {
+ $wgLoadBalancer->mServers[$i]['flags'] |= DBO_DEBUG;
+ }
+ }
+ if ( $d > 2 ) {
+ $wgDebugFunctionEntry = true;
+ }
+}
+
+
while ( ( $line = readconsole( '> ' ) ) !== false ) {
$val = eval( $line . ";" );
if( is_null( $val ) ) {
$wikiadmin_pass = `wikiadmin_pass`;
$wikisql_pass = `wikisql_pass`;
-$hosts = array(
- 'localhost',
- '207.142.131.194',
- '207.142.131.195',
- '207.142.131.196',
- '207.142.131.197',
- '207.142.131.198',
- '207.142.131.199',
- '207.142.131.226',
- '207.142.131.227',
- '207.142.131.228',
- '207.142.131.229',
- '207.142.131.230',
- '207.142.131.231',
- '207.142.131.232',
- '207.142.131.233',
- '207.142.131.234',
- '207.142.131.237',
- '207.142.131.238',
- '207.142.131.239',
- '207.142.131.243',
- '207.142.131.244',
- '207.142.131.249',
- '207.142.131.250',
- '207.142.131.216',
- '10.0.%',
-);
+if ( @$argv[1] == 'yaseo' ) {
+ $hosts = array(
+ 'localhost',
+ '211.115.107.158',
+ '211.115.107.159',
+ '211.115.107.160',
+ '211.115.107.138',
+ '211.115.107.139',
+ '211.115.107.140',
+ '211.115.107.141',
+ '211.115.107.142',
+ '211.115.107.143',
+ '211.115.107.144',
+ '211.115.107.145',
+ '211.115.107.146',
+ '211.115.107.147',
+ '211.115.107.148',
+ '211.115.107.149',
+ '211.115.107.150',
+ '211.115.107.152',
+ '211.115.107.153',
+ '211.115.107.154',
+ '211.115.107.155',
+ '211.115.107.156',
+ '211.115.107.157',
+ );
+} else {
+ $hosts = array(
+ 'localhost',
+ '207.142.131.194',
+ '207.142.131.195',
+ '207.142.131.196',
+ '207.142.131.197',
+ '207.142.131.198',
+ '207.142.131.199',
+ '207.142.131.226',
+ '207.142.131.227',
+ '207.142.131.228',
+ '207.142.131.229',
+ '207.142.131.230',
+ '207.142.131.231',
+ '207.142.131.232',
+ '207.142.131.233',
+ '207.142.131.234',
+ '207.142.131.237',
+ '207.142.131.238',
+ '207.142.131.239',
+ '207.142.131.243',
+ '207.142.131.244',
+ '207.142.131.249',
+ '207.142.131.250',
+ '207.142.131.216',
+ '10.0.%',
+ );
+}
$databases = array(
'%wikibooks',
}
function getRebuildInterwikiSQL() {
- global $langlist, $languageAliases, $wgDBname;
+ global $langlist, $languageAliases, $prefixRewrites, $wgDBname;
- # Initialise lists of wikis
+ # Multi-language sites
+ # db suffix => db suffix, iw prefix, hostname
$sites = array(
'wiki' => new Site( 'wiki', 'w', 'wikipedia.org' ),
'wiktionary' => new Site( 'wiktionary', 'wikt', 'wiktionary.org' ),
'wikiquote' => new Site( 'wikiquote', 'q', 'wikiquote.org' ),
'wikibooks' => new Site( 'wikibooks', 'b', 'wikibooks.org' ),
'wikinews' => new Site( 'wikinews', 'n', 'wikinews.org' ),
+ 'wikisource' => new Site( 'wikisource', 's', 'wikisource.org' ),
);
+
+ # List of language prefixes likely to be found in multi-language sites
$langlist = array_map( "trim", file( "/home/wikipedia/common/langlist" ) );
+
+ # 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',
'commonswiki' => 'commons.wikimedia.org',
);
+ # Extra interwiki links that can't be in the intermap for some reason
$extraLinks = array(
array( 'm', 'http://meta.wikimedia.org/wiki/$1', 1 ),
array( 'meta', 'http://meta.wikimedia.org/wiki/$1', 1 ),
array( 'sep11', 'http://sep11.wikipedia.org/wiki/$1', 1 ),
);
+ # Language aliases, usually configured as redirects to the real wiki in apache
+ # Interlanguage links are made directly to the real wiki
+ # Something horrible happens if you forget to list an alias here, I can't
+ # remember what
$languageAliases = array(
'zh-cn' => 'zh',
'zh-tw' => 'zh',
'nb' => 'no',
);
+ # Special case prefix rewrites, for the benefit of Swedish which uses s:t
+ # as an abbreviation for saint
+ $prefixRewrites = array(
+ 'svwiki' => array( 's' => 'src' ),
+ );
+
# Construct a list of reserved prefixes
$reserved = array();
foreach ( $langlist as $lang ) {
$intermap = wfGetHTTP( 'http://meta.wikimedia.org/w/index.php?title=Interwiki_map&action=raw' );
$lines = array_map( 'trim', explode( "\n", trim( $intermap ) ) );
- if ( !$lines ) {
+ if ( !$lines || count( $lines ) < 2 ) {
die( "m:Interwiki_map not found" );
}
# Intermap links
foreach ( $iwArray as $iwEntry ) {
- $sql .= makeLink( $iwEntry, $first );
+ $sql .= makeLink( $iwEntry, $first, $db );
}
# Links to multilanguage sites
foreach ( $sites as $targetSite ) {
- $sql .= makeLink( array( $targetSite->lateral, $targetSite->getURL( 'en' ), 1 ), $first );
+ $sql .= makeLink( array( $targetSite->lateral, $targetSite->getURL( 'en' ), 1 ), $first, $db );
}
# Interlanguage links to wikipedia
- $sql .= makeLanguageLinks( $sites['wiki'], $first );
+ $sql .= makeLanguageLinks( $sites['wiki'], $first, $db );
# Extra links
foreach ( $extraLinks as $link ) {
- $sql .= makeLink( $link, $first );
+ $sql .= makeLink( $link, $first, $db );
}
$sql .= ";\n";
if ( ( $suffix == 'wiki' && $iwEntry['iw_prefix'] != 'wikipedia' ) ||
( $suffix != 'wiki' && $suffix != $iwEntry['iw_prefix'] ) )
{
- $sql .= makeLink( $iwEntry, $first );
+ $sql .= makeLink( $iwEntry, $first, $db );
}
}
foreach ( $sites as $targetSite ) {
# Suppress link to self
if ( $targetSite->suffix != $site->suffix ) {
- $sql .= makeLink( array( $targetSite->lateral, $targetSite->getURL( $lang ), 1 ), $first );
+ $sql .= makeLink( array( $targetSite->lateral, $targetSite->getURL( $lang ), 1 ), $first, $db );
}
}
# Interlanguage links
- $sql .= makeLanguageLinks( $site, $first );
+ $sql .= makeLanguageLinks( $site, $first, $db );
# w link within wikipedias
# Other sites already have it as a lateral link
if ( $site->suffix == "wiki" ) {
- $sql .= makeLink( array("w", "http://en.wikipedia.org/wiki/$1", 1), $first );
+ $sql .= makeLink( array("w", "http://en.wikipedia.org/wiki/$1", 1), $first, $db );
}
# Extra links
foreach ( $extraLinks as $link ){
- $sql .= makeLink( $link, $first );
+ $sql .= makeLink( $link, $first, $db );
}
$sql .= ";\n\n";
}
# ------------------------------------------------------------------------------------------
# Returns part of an INSERT statement, corresponding to all interlanguage links to a particular site
-function makeLanguageLinks( &$site, &$first ) {
+function makeLanguageLinks( &$site, &$first, $source ) {
global $langlist, $languageAliases;
$sql = "";
# Actual languages with their own databases
foreach ( $langlist as $targetLang ) {
- $sql .= makeLink( array( $targetLang, $site->getURL( $targetLang ), 1 ), $first );
+ $sql .= makeLink( array( $targetLang, $site->getURL( $targetLang ), 1 ), $first, $source );
}
# Language aliases
foreach ( $languageAliases as $alias => $lang ) {
- $sql .= makeLink( array( $alias, $site->getURL( $lang ), 1 ), $first );
+ $sql .= makeLink( array( $alias, $site->getURL( $lang ), 1 ), $first, $source );
}
return $sql;
}
# Make SQL for a single link from an array
-function makeLink( $entry, &$first ) {
+function makeLink( $entry, &$first, $source ) {
+ global $prefixRewrites;
+
+ if ( isset( $prefixRewrites[$source] ) && isset( $prefixRewrites[$source][$entry[0]] ) ) {
+ $entry[0] = $prefixRewrites[$source][$entry[0]];
+ }
+
$sql = "";
# Add comma
if ( $first ) {
$optionsWithArgs = array( "o" );
include_once( "commandLine.inc" );
include_once( "rebuildInterwiki.inc" );
+chdir( $oldCwd );
$sql = getRebuildInterwikiSQL();
# Output
if ( isset( $options['o'] ) ) {
# To file specified with -o
- chdir( $oldCwd );
$file = fopen( $options['o'], "w" );
fwrite( $file, $sql );
fclose( $file );
display: block;
}
head:first-child + body #footer li { white-space: normal; }
+.usermessage { display: none; }
+.editsection { display: none; }