use Hooks;
use Interwiki;
use Language;
+use WikiMap;
use MapCacheLRU;
use WANObjectCache;
use Wikimedia\Rdbms\Database;
*/
private function getInterwikiCacheEntry( $prefix ) {
wfDebug( __METHOD__ . "( $prefix )\n" );
+
+ $wikiId = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
+
$value = false;
try {
// Resolve site name
if ( $this->interwikiScopes >= 3 && !$this->thisSite ) {
- $this->thisSite = $this->getCacheValue( '__sites:' . wfWikiID() );
+ $this->thisSite = $this->getCacheValue( '__sites:' . $wikiId );
if ( $this->thisSite == '' ) {
$this->thisSite = $this->fallbackSite;
}
}
- $value = $this->getCacheValue( wfWikiID() . ':' . $prefix );
+ $value = $this->getCacheValue( $wikiId . ':' . $prefix );
// Site level
if ( $value == '' && $this->interwikiScopes >= 3 ) {
$value = $this->getCacheValue( "_{$this->thisSite}:{$prefix}" );
}
}
+ $fname = __METHOD__;
$iwData = $this->objectCache->getWithSetCallback(
$this->objectCache->makeKey( 'interwiki', $prefix ),
$this->objectCacheExpiry,
- function ( $oldValue, &$ttl, array &$setOpts ) use ( $prefix ) {
+ function ( $oldValue, &$ttl, array &$setOpts ) use ( $prefix, $fname ) {
$dbr = wfGetDB( DB_REPLICA ); // TODO: inject LoadBalancer
$setOpts += Database::getCacheSetOptions( $dbr );
'interwiki',
self::selectFields(),
[ 'iw_prefix' => $prefix ],
- __METHOD__
+ $fname
);
return $row ? (array)$row : '!NONEXISTENT';
*/
private function getAllPrefixesCached( $local ) {
wfDebug( __METHOD__ . "()\n" );
+
+ $wikiId = WikiMap::getWikiIdFromDbDomain( WikiMap::getCurrentWikiDbDomain() );
+
$data = [];
try {
/* Resolve site name */
if ( $this->interwikiScopes >= 3 && !$this->thisSite ) {
- $site = $this->getCacheValue( '__sites:' . wfWikiID() );
+ $site = $this->getCacheValue( '__sites:' . $wikiId );
if ( $site == '' ) {
$this->thisSite = $this->fallbackSite;
if ( $this->interwikiScopes >= 3 ) {
$sources[] = '_' . $this->thisSite;
}
- $sources[] = wfWikiID();
+ $sources[] = $wikiId;
foreach ( $sources as $source ) {
$list = $this->getCacheValue( '__list:' . $source );