4 public static function onExtensionFunctions() {
5 global $wgInterwikiViewOnly;
7 if ( $wgInterwikiViewOnly === false ) {
8 global $wgAvailableRights, $wgLogTypes, $wgLogActionsHandlers;
10 // New user right, required to modify the interwiki table through Special:Interwiki
11 $wgAvailableRights[] = 'interwiki';
13 // Set up the new log type - interwiki actions are logged to this new log
14 $wgLogTypes[] = 'interwiki';
15 // interwiki, iw_add, iw_delete, iw_edit
16 $wgLogActionsHandlers['interwiki/*'] = 'InterwikiLogFormatter';
22 public static function onInterwikiLoadPrefix( $prefix, &$iwData ) {
23 global $wgInterwikiCentralDB;
24 // docs/hooks.txt says: Return true without providing an interwiki to continue interwiki search.
25 if ( $wgInterwikiCentralDB === null || $wgInterwikiCentralDB === wfWikiID() ) {
26 // No global set or this is global, nothing to add
29 if ( !Language::fetchLanguageName( $prefix ) ) {
30 // Check if prefix exists locally and skip
31 foreach ( Interwiki::getAllPrefixes( null ) as $id => $localPrefixInfo ) {
32 if ( $prefix === $localPrefixInfo['iw_prefix'] ) {
36 $dbr = wfGetDB( DB_SLAVE, [], $wgInterwikiCentralDB );
37 $res = $dbr->selectRow(
40 [ 'iw_prefix' => $prefix ],
46 // Excplicitly make this an array since it's expected to be one
47 $iwData = (array)$res;
48 // At this point, we can safely return false because we know that we have something