-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterwikiDetection.php
More file actions
107 lines (100 loc) · 4.29 KB
/
InterwikiDetection.php
File metadata and controls
107 lines (100 loc) · 4.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* InterwikiDetection extension by Nathan Larson
* URL: http://nathania.org/wiki/Miscellany:InterwikiDetection
*
* This program is free software. You can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. You can also redistribute it and/or
* modify it under the terms of the Creative Commons Attribution 3.0 license.
*
* This extension looks up all the wikilinks on a page that would otherwise be red and compares them
* to a table of page titles to determine whether they exist on a remote wiki. If so, the wikilink
* turns blue and links to the page on the remote wiki.
*/
/* Alert the user that this is not a valid entry point to MediaWiki if they try to access the
special pages file directly.*/
if ( !defined( 'MEDIAWIKI' ) ) {
echo <<<EOT
To install the RPED extension, put the following line in LocalSettings.php:
require( "extensions/RPED/RPED.php" );
EOT;
exit( 1 );
}
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => 'Interwiki detection',
'namemsg' => 'interwikidetection',
'author' => 'Nathan Larson',
'url' => 'http://nathania.org/wiki/Miscellany:InterwikiDetection',
'descriptionmsg' => 'interwikidetection-desc',
'version' => '1.0.1',
);
$wgAutoloadClasses['InterwikiDetectionHooks'] = __DIR__ . '/InterwikiDetection.hooks.php';
$wgAutoloadClasses['PollAction'] = __DIR__ . '/InterwikiDetection.hooks.php';
$wgAutoloadClasses['NullifyAction'] = __DIR__ . '/InterwikiDetection.hooks.php';
$wgExtensionMessagesFiles['InterwikiDetection'] = __DIR__ . '/InterwikiDetection.i18n.php';
$wgHooks['LoadExtensionSchemaUpdates'][] =
'InterwikiDetectionHooks::InterwikiDetectionCreateTable';
$wgHooks['LinksUpdate'][] = 'InterwikiDetectionHooks::onLinksUpdate';
$wgHooks['LinksUpdateComplete'][] = 'InterwikiDetectionHooks::onLinksUpdateComplete';
$wgHooks['LinkEnd'][] = 'InterwikiDetectionHooks::interwikiDetectionLinkEnd';
$wgInterwikiDetectionExistingInterwikis = array();
$wgInterwikiDetectionExistingLinks = array();
$wgInterwikiDetectionWikipediaPrefixes = array(
'w',
'wikipedia'
);
$wgHooks['SkinTemplateTabs'][] = 'InterwikiDetectionHooks::InterwikiDetectionSkinTemplateTabs';
$wgHooks['SkinTemplateNavigation'][] =
'InterwikiDetectionHooks::InterwikiDetectionSkinTemplateNavigation';
$wgActions['poll'] = 'PollAction';
$wgActions['nullify'] = 'NullifyAction';
$wgInterwikiDetectionNamespaces = array(
-2 => 'Media:',
-1 => 'Special:',
0 => '',
1 => 'Talk:',
2 => 'User:',
3 => 'User talk:',
4 => 'Project:',
5 => 'Project talk:',
6 => 'File:',
7 => 'File talk:',
8 => 'MediaWiki:',
9 => 'MediaWiki talk:',
10 => 'Template:',
11 => 'Template talk:',
12 => 'Help:',
13 => 'Help talk:',
14 => 'Category:',
15 => 'Category talk:',
828 => 'Module:',
829 => 'Module talk:',
2300 => 'Gadget:',
2301 => 'Gadget talk:',
2302 => 'Gadget definition:'
);
$wgInterwikiDetectionWikipediaUrl = 'https://en.wikipedia.org/wiki/$1';
$wgGroupPermissions['sysop']['poll'] = true;
$wgGroupPermissions['sysop']['nullify'] = true;
// Don't poll more than once every x seconds
$wgInterwikiDetectionMinimumSecondsBetweenPolls = -1;
// This is to prevent infinite loops from occurring
$wgInterwikiExistenceRecursionInProgress = false;
// This is the interwiki prefix to use for making blue links.
$wgInterwikiDetectionPrefix = 'wikipedia';
$wgInterwikiDetectionLocalLinksGoInterwiki = true;
#$wgInterwikiDetectionApiQueryBegin = 'https://en.wikipedia.org/w/api.php?action=query&titles=';
$wgInterwikiDetectionApiQueryBegin = 'https://en.wikipedia.org/w/api.php?action=query&format=json';
#$wgInterwikiDetectionApiQuerySeparator = '%7C';
$wgInterwikiDetectionApiQuerySeparator = '|';
#$wgInterwikiDetectionApiQueryEnd = '&format=jsonfm';
$wgInterwikiDetectionApiQueryEnd = '&format=json';
$wgInterwikiDetectionOrphanInterval = 1000000; // A day?
// The user-agent to use in requests to the wikis from which the interwiki maps are obtained
$wgInterwikiDetectionUserAgent = "User-Agent: $wgSitename's InterwikiExistence. Contact info: URL: "
. $wgServer . $wgScriptPath . " Email: $wgEmergencyContact";
// TODO: Create a special page, Special:InterwikiPoll
// TODO: Create a tab, Nullify; base this on Extension:Chat or Extension:Purge or something