protected $mPrefix, $mURL, $mLocal, $mTrans;
- function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 )
- {
+ function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ){
$this->mPrefix = $prefix;
$this->mURL = $url;
$this->mLocal = $local;
return self::$smCache[$prefix];
}
global $wgInterwikiCache;
- if ($wgInterwikiCache) {
+ if( $wgInterwikiCache ) {
$iw = Interwiki::getInterwikiCached( $prefix );
} else {
$iw = Interwiki::load( $prefix );
self::$smCache[$prefix] = $iw;
return $iw;
}
-
+
/**
* Fetch interwiki prefix data from local cache in constant database.
*
*/
protected static function getInterwikiCached( $prefix ) {
$value = self::getInterwikiCacheEntry( $prefix );
-
+
$s = new Interwiki( $prefix );
if ( $value != '' ) {
// Split values
list( $local, $url ) = explode( ' ', $value, 2 );
$s->mURL = $url;
$s->mLocal = (int)$local;
- }else{
+ } else {
$s = false;
}
return $s;
}
-
+
/**
* Get entry from interwiki cache
*
/* Resolve site name */
if( $wgInterwikiScopes>=3 && !$site ) {
$site = dba_fetch( '__sites:' . wfWikiID(), $db );
- if ( $site == "" ){
+ if ( $site == '' ){
$site = $wgInterwikiFallbackSite;
}
}
-
+
$value = dba_fetch( wfMemcKey( $prefix ), $db );
// Site level
if ( $value == '' && $wgInterwikiScopes >= 3 ) {
}
if ( $value == 'undef' )
$value = '';
-
+
return $value;
}
* @param $prefix The interwiki prefix
* @return bool The prefix is valid
* @static
- *
*/
protected static function load( $prefix ) {
global $wgMemc, $wgInterwikiExpiry;
return $iw;
}
}
-
+
$db = wfGetDB( DB_SLAVE );
-
+
$row = $db->fetchRow( $db->select( 'interwiki', '*', array( 'iw_prefix' => $prefix ),
__METHOD__ ) );
$iw = Interwiki::loadFromArray( $row );
$wgMemc->add( $key, $mc, $wgInterwikiExpiry );
return $iw;
}
-
+
return false;
}
}
return false;
}
-
- /**
+
+ /**
* Get the URL for a particular title (or with $1 if no title given)
*
* @param $title string What text to put for the article name
}
return $url;
}
-
+
function isLocal(){
return $this->mLocal;
}
-
+
function isTranscludable(){
return $this->mTrans;
}