$this->mURL = $url;
$this->mAPI = $api;
$this->mWikiID = $wikiId;
- $this->mLocal = $local;
- $this->mTrans = $trans;
+ $this->mLocal = (bool)$local;
+ $this->mTrans = (bool)$trans;
}
/**
}
/**
- * Purge the cache for an interwiki prefix
+ * Resets locally cached Interwiki objects. This is intended for use during testing only.
+ * This does not invalidate entries in the persistent cache, as invalidateCache() does.
+ * @since 1.27
+ */
+ public static function resetLocalCache() {
+ static::$smCache = [];
+ }
+
+ /**
+ * Purge the cache (local and persistent) for an interwiki prefix.
* @param string $prefix
* @since 1.26
*/
$cache = ObjectCache::getMainWANInstance();
$key = wfMemcKey( 'interwiki', $prefix );
$cache->delete( $key );
+ unset( static::$smCache[$prefix] );
}
/**
// Split values
list( $local, $url ) = explode( ' ', $value, 2 );
$s->mURL = $url;
- $s->mLocal = (int)$local;
+ $s->mLocal = (bool)$local;
} else {
$s = false;
}
if ( isset( $mc['iw_url'] ) ) {
$iw = new Interwiki();
$iw->mURL = $mc['iw_url'];
- $iw->mLocal = isset( $mc['iw_local'] ) ? $mc['iw_local'] : 0;
- $iw->mTrans = isset( $mc['iw_trans'] ) ? $mc['iw_trans'] : 0;
+ $iw->mLocal = isset( $mc['iw_local'] ) ? (bool)$mc['iw_local'] : false;
+ $iw->mTrans = isset( $mc['iw_trans'] ) ? (bool)$mc['iw_trans'] : false;
$iw->mAPI = isset( $mc['iw_api'] ) ? $mc['iw_api'] : '';
$iw->mWikiID = isset( $mc['iw_wikiid'] ) ? $mc['iw_wikiid'] : '';
public function getName() {
$msg = wfMessage( 'interwiki-name-' . $this->mPrefix )->inContentLanguage();
- return !$msg->exists() ? '' : $msg;
+ return !$msg->exists() ? '' : $msg->text();
}
/**
public function getDescription() {
$msg = wfMessage( 'interwiki-desc-' . $this->mPrefix )->inContentLanguage();
- return !$msg->exists() ? '' : $msg;
+ return !$msg->exists() ? '' : $msg->text();
}
/**