Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -962,6 +962,12 @@ |
963 | 963 | $target: Title/string of redirect target |
964 | 964 | $article: Article object |
965 | 965 | |
| 966 | +'InterwikiLoadPrefix': When resolving if a given prefix is an interwiki or not. |
| 967 | +Return true without providing an interwiki to continue interwiki search. |
| 968 | +$prefix: interwiki prefix we are looking for. |
| 969 | +&$iwData: output array describing the interwiki with keys iw_url, iw_local, |
| 970 | + iw_trans and optionally iw_api and iw_wikiid. |
| 971 | + |
966 | 972 | 'InternalParseBeforeLinks': during Parser's internalParse method before links |
967 | 973 | but after noinclude/includeonly/onlyinclude and other processing. |
968 | 974 | &$parser: Parser object |
Index: trunk/phase3/includes/Interwiki.php |
— | — | @@ -141,11 +141,19 @@ |
142 | 142 | */ |
143 | 143 | protected static function load( $prefix ) { |
144 | 144 | global $wgMemc, $wgInterwikiExpiry; |
145 | | - $key = wfMemcKey( 'interwiki', $prefix ); |
146 | | - $mc = $wgMemc->get( $key ); |
147 | 145 | |
148 | | - if( $mc && is_array( $mc ) ) { // is_array is hack for old keys |
149 | | - $iw = Interwiki::loadFromArray( $mc ); |
| 146 | + $iwData = false; |
| 147 | + if ( !wfRunHooks('InterwikiLoadPrefix', array( $prefix, &$iwData ) ) ) { |
| 148 | + return Interwiki::loadFromArray( $iwData ); |
| 149 | + } |
| 150 | + |
| 151 | + if ( !$iwData ) { |
| 152 | + $key = wfMemcKey( 'interwiki', $prefix ); |
| 153 | + $iwData = $wgMemc->get( $key ); |
| 154 | + } |
| 155 | + |
| 156 | + if( $iwData && is_array( $iwData ) ) { // is_array is hack for old keys |
| 157 | + $iw = Interwiki::loadFromArray( $iwData ); |
150 | 158 | if( $iw ) { |
151 | 159 | return $iw; |
152 | 160 | } |