protected static $smCache = array();
const CACHE_LIMIT = 100; // 0 means unlimited, any other value is max number of entries.
- protected $mPrefix, $mURL, $mLocal, $mTrans;
+ protected $mPrefix, $mURL, $mAPI, $mWikiID, $mLocal, $mTrans;
- public function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) {
+ public function __construct( $prefix = null, $url = '', $api = '', $wikiid = '', $local = 0, $trans = 0 ) {
$this->mPrefix = $prefix;
$this->mURL = $url;
+ $this->mAPI = $api;
+ $this->mWikiID = $wikiid;
$this->mLocal = $local;
$this->mTrans = $trans;
}
__METHOD__ ) );
$iw = Interwiki::loadFromArray( $row );
if ( $iw ) {
- $mc = array( 'iw_url' => $iw->mURL, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans );
+ $mc = array( 'iw_url' => $iw->mURL, 'iw_api' => $iw->mAPI, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans );
$wgMemc->add( $key, $mc, $wgInterwikiExpiry );
return $iw;
}
* @return Boolean: whether everything was there
*/
protected static function loadFromArray( $mc ) {
- if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) {
+ if( isset( $mc['iw_url'] ) && isset( $mc['iw_api'] ) && isset( $mc['iw_wikiid'] )
+ && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) {
$iw = new Interwiki();
$iw->mURL = $mc['iw_url'];
+ $iw->mAPI = $mc['iw_api'];
+ $iw->mWikiID = $mc['iw_wikiid'];
$iw->mLocal = $mc['iw_local'];
$iw->mTrans = $mc['iw_trans'];
return $iw;
return $url;
}
+ /**
+ * Get the API URL for this wiki
+ *
+ * @return String: the URL
+ */
+ public function getAPI( ) {
+ return $this->mAPI;
+ }
+
+ /**
+ * Get the DB name for this wiki
+ *
+ * @return String: the DB name
+ */
+ public function getWikiID( ) {
+ return $this->mWikiID;
+ }
+
/**
* Is this a local link from a sister project, or is
* it something outside, like Google
return Interwiki::fetch( $this->mInterwiki )->isTranscludable();
}
+ /**
+ * Returns the DB name of the distant wiki
+ * which owns the object.
+ *
+ * @return \type{\string} the DB name
+ */
+ public function getTransWikiID() {
+ if ( $this->mInterwiki == '' )
+ return false;
+
+ return Interwiki::fetch( $this->mInterwiki )->getWikiID();
+ }
+
/**
* Escape a text fragment, say from a link, for a URL
*
'1.17' => array(
array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ),
array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ),
- array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' )
+ array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
+ array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
),
);
}
array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ),
array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ),
array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
+ array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
),
);
}