Index: trunk/phase3/maintenance/archives/patch-iw_api_and_wikiid.sql |
— | — | @@ -0,0 +1,9 @@ |
| 2 | +-- |
| 3 | +-- Add iw_api and iw_wikiid to interwiki table |
| 4 | +-- |
| 5 | + |
| 6 | +ALTER TABLE /*_*/interwiki |
| 7 | + ADD iw_api BLOB NOT NULL; |
| 8 | +ALTER TABLE /*_*/interwiki |
| 9 | + ADD iw_wikiid varchar(64) NOT NULL; |
| 10 | + |
Property changes on: trunk/phase3/maintenance/archives |
___________________________________________________________________ |
Added: svn:mergeinfo |
1 | 11 | Merged /branches/iwtransclusion/phase3/maintenance/archives:r69540 |
2 | 12 | Merged /branches/new-installer/phase3/maintenance/archives:r43664-66004 |
3 | 13 | Merged /branches/REL1_15/phase3/maintenance/archives:r51646 |
4 | 14 | Merged /branches/sqlite/maintenance/archives:r58211-58321 |
Index: trunk/phase3/maintenance/tables.sql |
— | — | @@ -1068,6 +1068,12 @@ |
1069 | 1069 | -- insertion. |
1070 | 1070 | iw_url blob NOT NULL, |
1071 | 1071 | |
| 1072 | + -- The URL of the file api.php |
| 1073 | + iw_api blob NOT NULL, |
| 1074 | + |
| 1075 | + -- The name of the database (for a connection to be established with wfGetLB( 'wikiid' )) |
| 1076 | + iw_wikiid varchar(64) NOT NULL, |
| 1077 | + |
1072 | 1078 | -- A boolean value indicating whether the wiki is in this project |
1073 | 1079 | -- (used, for example, to detect redirect loops) |
1074 | 1080 | iw_local bool NOT NULL, |
Property changes on: trunk/phase3/maintenance/tables.sql |
___________________________________________________________________ |
Added: svn:mergeinfo |
1075 | 1081 | Merged /branches/sqlite/maintenance/tables.sql:r58211-58321 |
1076 | 1082 | Merged /branches/iwtransclusion/phase3/maintenance/tables.sql:r68448,69480 |
1077 | 1083 | Merged /branches/new-installer/phase3/maintenance/tables.sql:r43664-66004 |
1078 | 1084 | Merged /branches/REL1_15/phase3/maintenance/tables.sql:r51646 |
Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -15,11 +15,13 @@ |
16 | 16 | protected static $smCache = array(); |
17 | 17 | const CACHE_LIMIT = 100; // 0 means unlimited, any other value is max number of entries. |
18 | 18 | |
19 | | - protected $mPrefix, $mURL, $mLocal, $mTrans; |
| 19 | + protected $mPrefix, $mURL, $mAPI, $mWikiID, $mLocal, $mTrans; |
20 | 20 | |
21 | | - public function __construct( $prefix = null, $url = '', $local = 0, $trans = 0 ) { |
| 21 | + public function __construct( $prefix = null, $url = '', $api = '', $wikiid = '', $local = 0, $trans = 0 ) { |
22 | 22 | $this->mPrefix = $prefix; |
23 | 23 | $this->mURL = $url; |
| 24 | + $this->mAPI = $api; |
| 25 | + $this->mWikiID = $wikiid; |
24 | 26 | $this->mLocal = $local; |
25 | 27 | $this->mTrans = $trans; |
26 | 28 | } |
— | — | @@ -153,7 +155,7 @@ |
154 | 156 | __METHOD__ ) ); |
155 | 157 | $iw = Interwiki::loadFromArray( $row ); |
156 | 158 | if ( $iw ) { |
157 | | - $mc = array( 'iw_url' => $iw->mURL, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans ); |
| 159 | + $mc = array( 'iw_url' => $iw->mURL, 'iw_api' => $iw->mAPI, 'iw_local' => $iw->mLocal, 'iw_trans' => $iw->mTrans ); |
158 | 160 | $wgMemc->add( $key, $mc, $wgInterwikiExpiry ); |
159 | 161 | return $iw; |
160 | 162 | } |
— | — | @@ -168,9 +170,12 @@ |
169 | 171 | * @return Boolean: whether everything was there |
170 | 172 | */ |
171 | 173 | protected static function loadFromArray( $mc ) { |
172 | | - if( isset( $mc['iw_url'] ) && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) { |
| 174 | + if( isset( $mc['iw_url'] ) && isset( $mc['iw_api'] ) && isset( $mc['iw_wikiid'] ) |
| 175 | + && isset( $mc['iw_local'] ) && isset( $mc['iw_trans'] ) ) { |
173 | 176 | $iw = new Interwiki(); |
174 | 177 | $iw->mURL = $mc['iw_url']; |
| 178 | + $iw->mAPI = $mc['iw_api']; |
| 179 | + $iw->mWikiID = $mc['iw_wikiid']; |
175 | 180 | $iw->mLocal = $mc['iw_local']; |
176 | 181 | $iw->mTrans = $mc['iw_trans']; |
177 | 182 | return $iw; |
— | — | @@ -193,6 +198,24 @@ |
194 | 199 | } |
195 | 200 | |
196 | 201 | /** |
| 202 | + * Get the API URL for this wiki |
| 203 | + * |
| 204 | + * @return String: the URL |
| 205 | + */ |
| 206 | + public function getAPI( ) { |
| 207 | + return $this->mAPI; |
| 208 | + } |
| 209 | + |
| 210 | + /** |
| 211 | + * Get the DB name for this wiki |
| 212 | + * |
| 213 | + * @return String: the DB name |
| 214 | + */ |
| 215 | + public function getWikiID( ) { |
| 216 | + return $this->mWikiID; |
| 217 | + } |
| 218 | + |
| 219 | + /** |
197 | 220 | * Is this a local link from a sister project, or is |
198 | 221 | * it something outside, like Google |
199 | 222 | * |
Property changes on: trunk/phase3/includes/Interwiki.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
200 | 223 | Merged /branches/REL1_15/phase3/includes/Interwiki.php:r51646 |
201 | 224 | Merged /branches/sqlite/includes/Interwiki.php:r58211-58321 |
202 | 225 | Merged /branches/iwtransclusion/phase3/includes/Interwiki.php:r68170,68448,69480,69541 |
203 | 226 | Merged /branches/new-installer/phase3/includes/Interwiki.php:r43664-66004 |
204 | 227 | Merged /branches/wmf-deployment/includes/Interwiki.php:r53381 |
Index: trunk/phase3/includes/installer/Updaters.php |
— | — | @@ -166,7 +166,8 @@ |
167 | 167 | '1.17' => array( |
168 | 168 | array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ), |
169 | 169 | array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ), |
170 | | - array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ) |
| 170 | + array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), |
| 171 | + array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ), |
171 | 172 | ), |
172 | 173 | ); |
173 | 174 | } |
— | — | @@ -206,6 +207,7 @@ |
207 | 208 | array( 'add_table', 'iwlinks', 'patch-iwlinks.sql' ), |
208 | 209 | array( 'add_index', 'iwlinks', 'iwl_prefix_from_title', 'patch-rename-iwl_prefix.sql' ), |
209 | 210 | array( 'add_field', 'updatelog', 'ul_value', 'patch-ul_value.sql' ), |
| 211 | + array( 'add_field', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ), |
210 | 212 | ), |
211 | 213 | ); |
212 | 214 | } |
Property changes on: trunk/phase3/includes/installer/Updaters.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
213 | 215 | Merged /branches/REL1_15/phase3/includes/installer/Updaters.php:r51646 |
214 | 216 | Merged /branches/sqlite/includes/installer/Updaters.php:r58211-58321 |
215 | 217 | Merged /branches/new-installer/phase3/includes/installer/Updaters.php:r43664-66004 |
216 | 218 | Merged /branches/wmf-deployment/includes/installer/Updaters.php:r53381 |
217 | 219 | Merged /branches/iwtransclusion/phase3/maintenance/updaters.inc:r69540 |
Index: trunk/phase3/includes/Title.php |
— | — | @@ -522,6 +522,19 @@ |
523 | 523 | } |
524 | 524 | |
525 | 525 | /** |
| 526 | + * Returns the DB name of the distant wiki |
| 527 | + * which owns the object. |
| 528 | + * |
| 529 | + * @return \type{\string} the DB name |
| 530 | + */ |
| 531 | + public function getTransWikiID() { |
| 532 | + if ( $this->mInterwiki == '' ) |
| 533 | + return false; |
| 534 | + |
| 535 | + return Interwiki::fetch( $this->mInterwiki )->getWikiID(); |
| 536 | + } |
| 537 | + |
| 538 | + /** |
526 | 539 | * Escape a text fragment, say from a link, for a URL |
527 | 540 | * |
528 | 541 | * @param $fragment string containing a URL or link fragment (after the "#") |
Property changes on: trunk/phase3/includes/Title.php |
___________________________________________________________________ |
Added: svn:mergeinfo |
529 | 542 | Merged /branches/sqlite/includes/Title.php:r58211-58321 |
530 | 543 | Merged /branches/iwtransclusion/phase3/includes/Title.php:r68448,69480 |
531 | 544 | Merged /branches/new-installer/phase3/includes/Title.php:r43664-66004 |
532 | 545 | Merged /branches/wmf-deployment/includes/Title.php:r53381 |
533 | 546 | Merged /branches/REL1_15/phase3/includes/Title.php:r51646 |