r1589 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r1588‎ | r1589 | r1590 >
Date:11:20, 21 August 2003
Author:vibber
Status:old
Tags:
Comment:
Move interwiki management from big ugly array into the database, with
memcached backing. Second 'wikipedia-interwiki.sql' has Wikipedia's
local interlanguage URLs.
Modified paths:
  • /trunk/phase3/includes/Interwiki.php (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)
  • /trunk/phase3/install.php (modified) (history)
  • /trunk/phase3/maintenance/interwiki.sql (added) (history)
  • /trunk/phase3/maintenance/tables.sql (modified) (history)
  • /trunk/phase3/maintenance/wikipedia-interwiki.sql (added) (history)

Diff [purge]

Index: trunk/phase3/includes/Interwiki.php
@@ -1,273 +1,5 @@
22 <?
3 -# Note -- this file is generated by maintenance/fetchInterwiki.pl
4 -# Edit and rerun that script rather than modifying this directly.
53
6 -/* private */ $wgValidInterwikis = array(
7 - # General interwiki links from the InterMap
8 - "AbbeNormal" => "http://www.ourpla.net/cgi-bin/pikie.cgi?$1",
9 - "AcadWiki" => "http://xarch.tu-graz.ac.at/autocad/wiki/$1",
10 - "Acronym" => "http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1",
11 - "Advogato" => "http://www.advogato.org/$1",
12 - "AIWiki" => "http://www.ifi.unizh.ch/ailab/aiwiki/aiw.cgi?$1",
13 - "ALife" => "http://news.alife.org/wiki/index.php?$1",
14 - "AndStuff" => "http://andstuff.org/wiki.php?$1",
15 - "Annotation" => "http://bayle.stanford.edu/crit/nph-med.cgi/$1",
16 - "AnnotationWiki" => "http://www.seedwiki.com/page.cfm?wikiid=368&doc=$1",
17 - "AwarenessWiki" => "http://taoriver.net/aware/$1",
18 - "BenefitsWiki" => "http://www.benefitslink.com/cgi-bin/wiki.cgi?$1",
19 - "BridgesWiki" => "http://c2.com/w2/bridges/$1",
20 - "C2find" => "http://c2.com/cgi/wiki?FindPage&value=$1",
21 - "Cache" => "http://www.google.com/search?q=cache:$1",
22 - "CLiki" => "http://ww.telent.net/cliki/$1",
23 - "CmWiki" => "http://www.ourpla.net/cgi-bin/wiki.pl?$1",
24 - "CreationMatters" => "http://www.ourpla.net/cgi-bin/wiki.pl?$1",
25 - "DejaNews" => "http://www.deja.com/=dnc/getdoc.xp?AN=$1",
26 - "Dictionary" => "http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1",
27 - "DiveIntoOsx" => "http://diveintoosx.org/$1",
28 - "DocBook" => "http://docbook.org/wiki/moin.cgi/$1",
29 - "DolphinWiki" => "http://www.object-arts.com/wiki/html/Dolphin/$1",
30 - "EfnetCeeWiki" => "http://purl.net/wiki/c/$1",
31 - "EfnetCppWiki" => "http://purl.net/wiki/cpp/$1",
32 - "EfnetPythonWiki" => "http://purl.net/wiki/python/$1",
33 - "EfnetXmlWiki" => "http://purl.net/wiki/xml/$1",
34 - "EljWiki" => "http://elj.sourceforge.net/phpwiki/index.php/$1",
35 - "EmacsWiki" => "http://www.emacswiki.org/cgi-bin/wiki.pl?$1",
36 - "FinalEmpire" => "http://final-empire.sourceforge.net/cgi-bin/wiki.pl?$1",
37 - "Foldoc" => "http://www.foldoc.org/foldoc/foldoc.cgi?$1",
38 - "FoxWiki" => "http://fox.wikis.com/wc.dll?Wiki~$1",
39 - "FreeBSDman" => "http://www.FreeBSD.org/cgi/man.cgi?apropos=1&query=$1",
40 - "Google" => "http://www.google.com/search?q=$1",
41 - "GoogleGroups" => "http://groups.google.com/groups?q=$1",
42 - "GreenCheese" => "http://www.greencheese.org/$1",
43 - "HammondWiki" => "http://www.dairiki.org/HammondWiki/index.php3?$1",
44 - "Haribeau" => "http://wiki.haribeau.de/cgi-bin/wiki.pl?$1",
45 - "IAWiki" => "http://www.IAwiki.net/$1",
46 - "IMDB" => "http://us.imdb.com/Title?$1",
47 - "JargonFile" => "http://sunir.org/apps/meta.pl?wiki=JargonFile&redirect=$1",
48 - "JiniWiki" => "http://www.cdegroot.com/cgi-bin/jini?$1",
49 - "JspWiki" => "http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1",
50 - "KmWiki" => "http://www.voght.com/cgi-bin/pywiki?$1",
51 - "KnowHow" => "http://www2.iro.umontreal.ca/~paquetse/cgi-bin/wiki.cgi?$1",
52 - "LanifexWiki" => "http://opt.lanifex.com/cgi-bin/wiki.pl?$1",
53 - "LegoWiki" => "http://www.object-arts.com/wiki/html/Lego-Robotics/$1",
54 - "LinuxWiki" => "http://www.linuxwiki.de/$1",
55 - "LugKR" => "http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?$1",
56 - "MathSongsWiki" => "http://SeedWiki.com/page.cfm?wikiid=237&doc=$1",
57 - "MbTest" => "http://www.usemod.com/cgi-bin/mbtest.pl?$1",
58 - "MeatBall" => "http://www.usemod.com/cgi-bin/mb.pl?$1",
59 - "MetaWiki" => "http://sunir.org/apps/meta.pl?$1",
60 - "MetaWikiPedia" => "http://meta.wikipedia.org/wiki/$1",
61 - "MoinMoin" => "http://purl.net/wiki/moin/$1",
62 - "MuWeb" => "http://www.dunstable.com/scripts/MuWebWeb?$1",
63 - "NetVillage" => "http://www.netbros.com/?$1",
64 - "OpenWiki" => "http://openwiki.com/?$1",
65 - "OrgPatterns" => "http://www.bell-labs.com/cgi-user/OrgPatterns/OrgPatterns?$1",
66 - "PangalacticOrg" => "http://www.pangalactic.org/Wiki/$1",
67 - "PersonalTelco" => "http://www.personaltelco.net/index.cgi/$1",
68 - "PhpWiki" => "http://phpwiki.sourceforge.net/phpwiki/index.php?$1",
69 - "Pikie" => "http://pikie.darktech.org/cgi/pikie?$1",
70 - "PPR" => "http://c2.com/cgi/wiki?$1",
71 - "PurlNet" => "http://purl.oclc.org/NET/$1",
72 - "PythonInfo" => "http://www.python.org/cgi-bin/moinmoin/$1",
73 - "PythonWiki" => "http://www.pythonwiki.de/$1",
74 - "PyWiki" => "http://www.voght.com/cgi-bin/pywiki?$1",
75 - "SeaPig" => "http://www.seapig.org/ $1",
76 - "SeattleWireless" => "http://seattlewireless.net/?$1",
77 - "SenseisLibrary" => "http://senseis.xmp.net/?$1",
78 - "Shakti" => "http://cgi.algonet.se/htbin/cgiwrap/pgd/ShaktiWiki/$1",
79 - "SourceForge" => "http://sourceforge.net/$1",
80 - "Squeak" => "http://minnow.cc.gatech.edu/squeak/$1",
81 - "StrikiWiki" => "http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?$1",
82 - "SVGWiki" => "http://www.protocol7.com/svg-wiki/default.asp?$1",
83 - "Tavi" => "http://tavi.sourceforge.net/index.php?$1",
84 - "TmNet" => "http://www.technomanifestos.net/?$1",
85 - "TMwiki" => "http://www.EasyTopicMaps.com/?page=$1",
86 - "TWiki" => "http://twiki.org/cgi-bin/view/$1",
87 - "TwistedWiki" => "http://purl.net/wiki/twisted/$1",
88 - "Unreal" => "http://wiki.beyondunreal.com/wiki/$1",
89 - "UseMod" => "http://www.usemod.com/cgi-bin/wiki.pl?$1",
90 - "VisualWorks" => "http://wiki.cs.uiuc.edu/VisualWorks/$1",
91 - "WebDevWikiNL" => "http://www.promo-it.nl/WebDevWiki/index.php?page=$1",
92 - "WebSeitzWiki" => "http://webseitz.fluxent.com/wiki/$1",
93 - "Why" => "http://clublet.com/c/c/why?$1",
94 - "Wiki" => "http://c2.com/cgi/wiki?$1",
95 - "WikiPedia" => "http://www.wikipedia.org/wiki/$1",
96 - "Wiktionary" => "http://wiktionary.org/wiki/$1",
97 - "WikiWorld" => "http://WikiWorld.com/wiki/index.php/$1",
98 - "YpsiEyeball" => "http://sknkwrks.dyndns.org:1957/writewiki/wiki.pl?$1",
99 - "ZWiki" => "http://www.zwiki.org/$1",
 4+/* This file is obsolete... 2003-08-21 */
1005
101 - # Some custom additions:
102 - "ReVo" => "http://purl.org/NET/voko/revo/art/$1.html",
103 - # eg [[ReVo:cerami]], [[ReVo:astero]] - note X-sensitive!
104 - "EcheI" => "http://www.ikso.net/cgi-bin/wiki.pl?$1",
105 - "E\xc4\x89eI" => "http://www.ikso.net/cgi-bin/wiki.pl?$1",
106 - "UnuMondo" => "http://unumondo.com/cgi-bin/wiki.pl?$1", # X-sensitive!
107 - "JEFO" => "http://esperanto.jeunes.free.fr/vikio/index.php?$1",
108 - "PMEG" => "http://www.bertilow.com/pmeg/$1.php",
109 - # ekz [[PMEG:gramatiko/kunligaj vortetoj/au]]
110 - "EnciclopediaLibre" => "http://enciclopedia.us.es/wiki.phtml?title=$1",
111 -
112 - # Wikipedia-specific stuff:
113 - # Special cases
114 - "w" => "http://www.wikipedia.org/wiki/$1", # DEPRECATED
115 - "m" => "http://meta.wikipedia.org/wiki/$1",
116 - "meta" => "http://meta.wikipedia.org/wiki/$1",
117 - "sep11" => "http://sep11.wikipedia.org/wiki/$1",
118 - "simple"=> "http://simple.wikipedia.com/wiki.cgi?$1",
119 - "wiktionary" => "http://wiktionary.org/wiki/$1",
120 -
121 - # These may not be recommended, may change...
122 - "PageHistory" => "http://www.wikipedia.org/w/wiki.phtml?title=$1&action=history",
123 - "UserContributions" => "http://www.wikipedia.org/w/wiki.phtml?title=Special:Contributions&target=$1",
124 - "BackLinks" => "http://www.wikipedia.org/w/wiki.phtml?title=Special:Whatlinkshere&target=$1"
125 - );
126 -
127 - # ISO 639 2-letter language codes
128 -$WikiPediaLanguages = array(
129 - "aa" => "http://aa.wikipedia.com/wiki.cgi?$1",
130 - "ab" => "http://ab.wikipedia.com/wiki.cgi?$1",
131 - "af" => "http://af.wikipedia.com/wiki.cgi?$1",
132 - "am" => "http://am.wikipedia.com/wiki.cgi?$1",
133 - "ar" => "http://ar.wikipedia.org/wiki/$1",
134 - "as" => "http://as.wikipedia.com/wiki.cgi?$1",
135 - "ay" => "http://ay.wikipedia.com/wiki.cgi?$1",
136 - "az" => "http://az.wikipedia.com/wiki.cgi?$1",
137 - "ba" => "http://ba.wikipedia.com/wiki.cgi?$1",
138 - "be" => "http://be.wikipedia.com/wiki.cgi?$1",
139 - "bh" => "http://bh.wikipedia.com/wiki.cgi?$1",
140 - "bi" => "http://bi.wikipedia.com/wiki.cgi?$1",
141 - "bn" => "http://bn.wikipedia.com/wiki.cgi?$1",
142 - "bs" => "http://bs.wikipedia.org/wiki/$1",
143 - "bo" => "http://bo.wikipedia.com/wiki.cgi?$1",
144 - "ca" => "http://ca.wikipedia.com/wiki.cgi?$1",
145 - "co" => "http://co.wikipedia.com/wiki.cgi?$1",
146 - "cs" => "http://cs.wikipedia.org/wiki/$1",
147 - "cy" => "http://cy.wikipedia.org/wiki/$1",
148 - "da" => "http://da.wikipedia.org/wiki/$1",
149 - "de" => "http://de.wikipedia.org/wiki/$1",
150 - "dk" => "http://da.wikipedia.org/wiki/$1",
151 - "dz" => "http://dz.wikipedia.com/wiki.cgi?$1",
152 - "el" => "http://el.wikipedia.org/wiki/$1",
153 - "en" => "http://www.wikipedia.org/wiki/$1", # May in future be renamed to en.wikipedia.org; should work as alternate
154 - "eo" => "http://eo.wikipedia.org/wiki/$1",
155 - "es" => "http://es.wikipedia.org/wiki/$1",
156 - "et" => "http://et.wikipedia.com/wiki.cgi?$1",
157 - "eu" => "http://eu.wikipedia.com/wiki.cgi?$1",
158 - "fa" => "http://fa.wikipedia.com/wiki.cgi?$1",
159 - "fi" => "http://fi.wikipedia.com/wiki.cgi?$1",
160 - "fj" => "http://fj.wikipedia.com/wiki.cgi?$1",
161 - "fo" => "http://fo.wikipedia.com/wiki.cgi?$1",
162 - "fr" => "http://fr.wikipedia.org/wiki/$1",
163 - "fy" => "http://fy.wikipedia.com/wiki.cgi?$1",
164 - "ga" => "http://ga.wikipedia.com/wiki.cgi?$1",
165 - "gl" => "http://gl.wikipedia.com/wiki.cgi?$1",
166 - "gn" => "http://gn.wikipedia.com/wiki.cgi?$1",
167 - "gu" => "http://gu.wikipedia.com/wiki.cgi?$1",
168 - "ha" => "http://ha.wikipedia.com/wiki.cgi?$1",
169 - "he" => "http://he.wikipedia.org/wiki/$1",
170 - "hi" => "http://hi.wikipedia.org/wiki/$1",
171 - "hr" => "http://hr.wikipedia.org/wiki/$1",
172 - "hu" => "http://hu.wikipedia.org/wiki/$1",
173 - "hy" => "http://hy.wikipedia.com/wiki.cgi?$1",
174 - "ia" => "http://ia.wikipedia.com/wiki.cgi?$1",
175 - "id" => "http://id.wikipedia.com/wiki.cgi?$1",
176 - "ik" => "http://ik.wikipedia.com/wiki.cgi?$1",
177 - "is" => "http://is.wikipedia.com/wiki.cgi?$1",
178 - "it" => "http://it.wikipedia.com/wiki.cgi?$1",
179 - "iu" => "http://iu.wikipedia.com/wiki.cgi?$1",
180 - "ja" => "http://ja.wikipedia.org/wiki/$1",
181 - "jv" => "http://jv.wikipedia.com/wiki.cgi?$1",
182 - "ka" => "http://ka.wikipedia.com/wiki.cgi?$1",
183 - "kk" => "http://kk.wikipedia.com/wiki.cgi?$1",
184 - "kl" => "http://kl.wikipedia.com/wiki.cgi?$1",
185 - "km" => "http://km.wikipedia.com/wiki.cgi?$1",
186 - "kn" => "http://kn.wikipedia.com/wiki.cgi?$1",
187 - "ko" => "http://ko.wikipedia.org/wiki/$1",
188 - "ks" => "http://ks.wikipedia.com/wiki.cgi?$1",
189 - "ku" => "http://ku.wikipedia.com/wiki.cgi?$1",
190 - "ky" => "http://ky.wikipedia.com/wiki.cgi?$1",
191 - "la" => "http://la.wikipedia.com/wiki.cgi?$1",
192 - "lo" => "http://lo.wikipedia.com/wiki.cgi?$1",
193 - "lv" => "http://lv.wikipedia.com/wiki.cgi?$1",
194 - "mg" => "http://mg.wikipedia.com/wiki.cgi?$1",
195 - "mi" => "http://mi.wikipedia.com/wiki.cgi?$1",
196 - "mk" => "http://mk.wikipedia.com/wiki.cgi?$1",
197 - "ml" => "http://ml.wikipedia.org/wiki/$1",
198 - "mn" => "http://mn.wikipedia.com/wiki.cgi?$1",
199 - "mo" => "http://mo.wikipedia.com/wiki.cgi?$1",
200 - "mr" => "http://mr.wikipedia.com/wiki.cgi?$1",
201 - "ms" => "http://ms.wikipedia.org/wiki/$1",
202 - "my" => "http://my.wikipedia.com/wiki.cgi?$1",
203 - "na" => "http://na.wikipedia.com/wiki.cgi?$1",
204 - "ne" => "http://ne.wikipedia.com/wiki.cgi?$1",
205 - "nl" => "http://nl.wikipedia.org/wiki/$1",
206 - "no" => "http://no.wikipedia.com/wiki.cgi?$1",
207 - "oc" => "http://oc.wikipedia.com/wiki.cgi?$1",
208 - "om" => "http://om.wikipedia.com/wiki.cgi?$1",
209 - "or" => "http://or.wikipedia.com/wiki.cgi?$1",
210 - "pa" => "http://pa.wikipedia.com/wiki.cgi?$1",
211 - "pl" => "http://pl.wikipedia.org/wiki/$1",
212 - "ps" => "http://ps.wikipedia.com/wiki.cgi?$1",
213 - "pt" => "http://pt.wikipedia.com/wiki.cgi?$1",
214 - "qu" => "http://qu.wikipedia.com/wiki.cgi?$1",
215 - "rm" => "http://rm.wikipedia.com/wiki.cgi?$1",
216 - "rn" => "http://rn.wikipedia.com/wiki.cgi?$1",
217 - "ro" => "http://ro.wikipedia.org/wiki/$1",
218 - "ru" => "http://ru.wikipedia.org/wiki/$1",
219 - "rw" => "http://rw.wikipedia.com/wiki.cgi?$1",
220 - "sa" => "http://sa.wikipedia.com/wiki.cgi?$1",
221 - "sd" => "http://sd.wikipedia.com/wiki.cgi?$1",
222 - "sg" => "http://sg.wikipedia.com/wiki.cgi?$1",
223 - "sh" => "http://sh.wikipedia.org/wiki/$1",
224 - "si" => "http://si.wikipedia.com/wiki.cgi?$1",
225 - "sk" => "http://sk.wikipedia.org/wiki/$1",
226 - "sl" => "http://sl.wikipedia.org/wiki/$1",
227 - "sm" => "http://sm.wikipedia.com/wiki.cgi?$1",
228 - "sn" => "http://sn.wikipedia.com/wiki.cgi?$1",
229 - "so" => "http://so.wikipedia.com/wiki.cgi?$1",
230 - "sq" => "http://sq.wikipedia.com/wiki.cgi?$1",
231 - "sr" => "http://sr.wikipedia.org/wiki/$1",
232 - "ss" => "http://ss.wikipedia.com/wiki.cgi?$1",
233 - "st" => "http://st.wikipedia.com/wiki.cgi?$1",
234 - "su" => "http://su.wikipedia.com/wiki.cgi?$1",
235 - "sv" => "http://sv.wikipedia.org/wiki/$1",
236 - "sw" => "http://sw.wikipedia.com/wiki.cgi?$1",
237 - "ta" => "http://ta.wikipedia.com/wiki.cgi?$1",
238 - "te" => "http://te.wikipedia.com/wiki.cgi?$1",
239 - "tg" => "http://tg.wikipedia.com/wiki.cgi?$1",
240 - "th" => "http://th.wikipedia.com/wiki.cgi?$1",
241 - "ti" => "http://ti.wikipedia.com/wiki.cgi?$1",
242 - "tk" => "http://tk.wikipedia.com/wiki.cgi?$1",
243 - "tl" => "http://tl.wikipedia.com/wiki.cgi?$1",
244 - "tn" => "http://tn.wikipedia.com/wiki.cgi?$1",
245 - "to" => "http://to.wikipedia.com/wiki.cgi?$1",
246 - "tr" => "http://tr.wikipedia.org/wiki/$1",
247 - "ts" => "http://ts.wikipedia.com/wiki.cgi?$1",
248 - "tt" => "http://tt.wikipedia.com/wiki.cgi?$1",
249 - "tw" => "http://tw.wikipedia.com/wiki.cgi?$1",
250 - "ug" => "http://ug.wikipedia.com/wiki.cgi?$1",
251 - "uk" => "http://uk.wikipedia.com/wiki.cgi?$1",
252 - "ur" => "http://ur.wikipedia.com/wiki.cgi?$1",
253 - "uz" => "http://uz.wikipedia.com/wiki.cgi?$1",
254 - "vi" => "http://vi.wikipedia.com/wiki.cgi?$1",
255 - "vo" => "http://vo.wikipedia.com/wiki.cgi?$1",
256 - "wo" => "http://wo.wikipedia.com/wiki.cgi?$1",
257 - "xh" => "http://xh.wikipedia.com/wiki.cgi?$1",
258 - "yi" => "http://yi.wikipedia.com/wiki.cgi?$1",
259 - "yo" => "http://yo.wikipedia.com/wiki.cgi?$1",
260 - "za" => "http://za.wikipedia.com/wiki.cgi?$1",
261 - "zh" => "http://zh.wikipedia.org/wiki/$1",
262 - "zh-cn" => "http://zh.wikipedia.org/wiki/$1",
263 - "zh-tw" => "http://zh.wikipedia.org/wiki/$1",
264 - "zu" => "http://zu.wikipedia.com/wiki.cgi?$1",
265 - "nds" => "http://nds.wikipedia.org/wiki.cgi?$1"
266 -);
267 -foreach($WikiPediaLanguages as $code => $url) {
268 - $wgValidInterwikis[ucfirst($code) . "WikiPedia"] = $url;
269 - $wgValidInterwikis[ucfirst($code) . "Wikipedia"] = $url;
270 - # If you're not Wikipedia, comment out next line!
271 - $wgValidInterwikis[$code] = $url;
272 -}
273 -
2746 ?>
Index: trunk/phase3/includes/Title.php
@@ -1,7 +1,5 @@
22 <?
33 # See title.doc
4 -global $IP;
5 -include_once( "$IP/Interwiki.php" );
64
75 class Title {
86 /* private */ var $mTextform, $mUrlform, $mDbkeyform;
@@ -81,11 +79,23 @@
8280
8381 function getInterwikiLink( $key )
8482 {
85 - global $wgValidInterwikis;
86 -
87 - if ( array_key_exists( $key, $wgValidInterwikis ) ) {
88 - return $wgValidInterwikis[$key];
89 - } else return "";
 83+ global $wgMemc, $wgDBname;
 84+ $k = "$wgDBname:interwiki:$key";
 85+ $s = $wgMemc->get( $k );
 86+ if( $s !== false ) return $s->iw_url;
 87+
 88+ $dkey = wfStrencode( $key );
 89+ $query = "SELECT iw_url FROM interwiki WHERE iw_prefix='$dkey'";
 90+ $res = wfQuery( $query, "Title::getInterwikiLink" );
 91+ if(!$res) return "";
 92+
 93+ $s = wfFetchObject( $res );
 94+ if(!$s) {
 95+ $s = (object)false;
 96+ $s->iw_url = "";
 97+ }
 98+ $wgMemc->set( $k, $s );
 99+ return $s->iw_url;
90100 }
91101
92102 function getText() { return $this->mTextform; }
@@ -169,12 +179,12 @@
170180
171181 function getFullURL()
172182 {
173 - global $wgLang, $wgArticlePath, $wgValidInterwikis;
 183+ global $wgLang, $wgArticlePath;
174184
175185 if ( "" == $this->mInterwiki ) {
176186 $p = $wgArticlePath;
177187 } else {
178 - $p = $wgValidInterwikis[$this->mInterwiki];
 188+ $p = $this->getInterwikiLink( $this->mInterwiki );
179189 }
180190 $n = $wgLang->getNsText( $this->mNamespace );
181191 if ( "" != $n ) { $n .= ":"; }
@@ -302,7 +312,7 @@
303313 #
304314 /* private */ function secureAndSplit()
305315 {
306 - global $wgLang, $wgValidInterwikis, $wgLocalInterwiki;
 316+ global $wgLang, $wgLocalInterwiki;
307317
308318 $validNamespaces = $wgLang->getNamespaces();
309319 unset( $validNamespaces[0] );
@@ -329,8 +339,11 @@
330340 if ( preg_match( "/^((?:i|x|[a-z]{2,3})(?:-[a-z0-9]+)?|[A-Za-z0-9_\\x80-\\xff]+):(.*)$/", $t, $m ) ) {
331341 #$p = strtolower( $m[1] );
332342 $p = $m[1];
333 - if ( array_key_exists( $p, $wgValidInterwikis ) ) {
 343+ if ( $ns = $wgLang->getNsIndex( strtolower( $p ) )) {
334344 $t = $m[2];
 345+ $this->mNamespace = $ns;
 346+ } elseif ( $this->getInterwikiLink( $p ) ) {
 347+ $t = $m[2];
335348 $this->mInterwiki = $p;
336349
337350 if ( preg_match( "/^([A-Za-z0-9_\\x80-\\xff]+):(.*)$/",
@@ -342,20 +355,6 @@
343356 if($this->mInterwiki != $wgLocalInterwiki)
344357 $done = true;
345358 }
346 - if ( ! $done ) {
347 - if ( $ns = $wgLang->getNsIndex( str_replace( " ", "_", $p ))) {
348 - $t = $m[2];
349 - $this->mNamespace = $ns;
350 - }
351 - # foreach ( $validNamespaces as $ns ) {
352 - # if ( 0 == strcasecmp( $p, $ns ) ) {
353 - # $t = $m[2];
354 - # $this->mNamespace = $wgLang->getNsIndex(
355 - # str_replace( " ", "_", $p ) );
356 - # break;
357 - # }
358 - # }
359 - }
360359 }
361360 $r = $t;
362361 }
Index: trunk/phase3/maintenance/interwiki.sql
@@ -0,0 +1,103 @@
 2+-- Based more or less on the public interwiki map from MeatballWiki
 3+-- Default interwiki prefixes...
 4+
 5+INSERT INTO interwiki (iw_prefix,iw_url,iw_local) VALUES
 6+('AbbeNormal','http://www.ourpla.net/cgi-bin/pikie.cgi?$1',0),
 7+('AcadWiki','http://xarch.tu-graz.ac.at/autocad/wiki/$1',0),
 8+('Acronym','http://www.acronymfinder.com/af-query.asp?String=exact&Acronym=$1',0),
 9+('Advogato','http://www.advogato.org/$1',0),
 10+('AIWiki','http://www.ifi.unizh.ch/ailab/aiwiki/aiw.cgi?$1',0),
 11+('ALife','http://news.alife.org/wiki/index.php?$1',0),
 12+('AndStuff','http://andstuff.org/wiki.php?$1',0),
 13+('Annotation','http://bayle.stanford.edu/crit/nph-med.cgi/$1',0),
 14+('AnnotationWiki','http://www.seedwiki.com/page.cfm?wikiid=368&doc=$1',0),
 15+('AwarenessWiki','http://taoriver.net/aware/$1',0),
 16+('BenefitsWiki','http://www.benefitslink.com/cgi-bin/wiki.cgi?$1',0),
 17+('BridgesWiki','http://c2.com/w2/bridges/$1',0),
 18+('C2find','http://c2.com/cgi/wiki?FindPage&value=$1',0),
 19+('Cache','http://www.google.com/search?q=cache:$1',0),
 20+('CLiki','http://ww.telent.net/cliki/$1',0),
 21+('CmWiki','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0),
 22+('CreationMatters','http://www.ourpla.net/cgi-bin/wiki.pl?$1',0),
 23+('DejaNews','http://www.deja.com/=dnc/getdoc.xp?AN=$1',0),
 24+('Dictionary','http://www.dict.org/bin/Dict?Database=*&Form=Dict1&Strategy=*&Query=$1',0),
 25+('DiveIntoOsx','http://diveintoosx.org/$1',0),
 26+('DocBook','http://docbook.org/wiki/moin.cgi/$1',0),
 27+('DolphinWiki','http://www.object-arts.com/wiki/html/Dolphin/$1',0),
 28+('EfnetCeeWiki','http://purl.net/wiki/c/$1',0),
 29+('EfnetCppWiki','http://purl.net/wiki/cpp/$1',0),
 30+('EfnetPythonWiki','http://purl.net/wiki/python/$1',0),
 31+('EfnetXmlWiki','http://purl.net/wiki/xml/$1',0),
 32+('EljWiki','http://elj.sourceforge.net/phpwiki/index.php/$1',0),
 33+('EmacsWiki','http://www.emacswiki.org/cgi-bin/wiki.pl?$1',0),
 34+('FinalEmpire','http://final-empire.sourceforge.net/cgi-bin/wiki.pl?$1',0),
 35+('Foldoc','http://www.foldoc.org/foldoc/foldoc.cgi?$1',0),
 36+('FoxWiki','http://fox.wikis.com/wc.dll?Wiki~$1',0),
 37+('FreeBSDman','http://www.FreeBSD.org/cgi/man.cgi?apropos=1&query=$1',0),
 38+('Google','http://www.google.com/search?q=$1',0),
 39+('GoogleGroups','http://groups.google.com/groups?q=$1',0),
 40+('GreenCheese','http://www.greencheese.org/$1',0),
 41+('HammondWiki','http://www.dairiki.org/HammondWiki/index.php3?$1',0),
 42+('Haribeau','http://wiki.haribeau.de/cgi-bin/wiki.pl?$1',0),
 43+('IAWiki','http://www.IAwiki.net/$1',0),
 44+('IMDB','http://us.imdb.com/Title?$1',0),
 45+('JargonFile','http://sunir.org/apps/meta.pl?wiki=JargonFile&redirect=$1',0),
 46+('JiniWiki','http://www.cdegroot.com/cgi-bin/jini?$1',0),
 47+('JspWiki','http://www.ecyrd.com/JSPWiki/Wiki.jsp?page=$1',0),
 48+('KmWiki','http://www.voght.com/cgi-bin/pywiki?$1',0),
 49+('KnowHow','http://www2.iro.umontreal.ca/~paquetse/cgi-bin/wiki.cgi?$1',0),
 50+('LanifexWiki','http://opt.lanifex.com/cgi-bin/wiki.pl?$1',0),
 51+('LegoWiki','http://www.object-arts.com/wiki/html/Lego-Robotics/$1',0),
 52+('LinuxWiki','http://www.linuxwiki.de/$1',0),
 53+('LugKR','http://lug-kr.sourceforge.net/cgi-bin/lugwiki.pl?$1',0),
 54+('MathSongsWiki','http://SeedWiki.com/page.cfm?wikiid=237&doc=$1',0),
 55+('MbTest','http://www.usemod.com/cgi-bin/mbtest.pl?$1',0),
 56+('MeatBall','http://www.usemod.com/cgi-bin/mb.pl?$1',0),
 57+('MetaWiki','http://sunir.org/apps/meta.pl?$1',0),
 58+('MetaWikiPedia','http://meta.wikipedia.org/wiki/$1',0),
 59+('MoinMoin','http://purl.net/wiki/moin/$1',0),
 60+('MuWeb','http://www.dunstable.com/scripts/MuWebWeb?$1',0),
 61+('NetVillage','http://www.netbros.com/?$1',0),
 62+('OpenWiki','http://openwiki.com/?$1',0),
 63+('OrgPatterns','http://www.bell-labs.com/cgi-user/OrgPatterns/OrgPatterns?$1',0),
 64+('PangalacticOrg','http://www.pangalactic.org/Wiki/$1',0),
 65+('PersonalTelco','http://www.personaltelco.net/index.cgi/$1',0),
 66+('PhpWiki','http://phpwiki.sourceforge.net/phpwiki/index.php?$1',0),
 67+('Pikie','http://pikie.darktech.org/cgi/pikie?$1',0),
 68+('PPR','http://c2.com/cgi/wiki?$1',0),
 69+('PurlNet','http://purl.oclc.org/NET/$1',0),
 70+('PythonInfo','http://www.python.org/cgi-bin/moinmoin/$1',0),
 71+('PythonWiki','http://www.pythonwiki.de/$1',0),
 72+('PyWiki','http://www.voght.com/cgi-bin/pywiki?$1',0),
 73+('SeaPig','http://www.seapig.org/ $1',0),
 74+('SeattleWireless','http://seattlewireless.net/?$1',0),
 75+('SenseisLibrary','http://senseis.xmp.net/?$1',0),
 76+('Shakti','http://cgi.algonet.se/htbin/cgiwrap/pgd/ShaktiWiki/$1',0),
 77+('SourceForge','http://sourceforge.net/$1',0),
 78+('Squeak','http://minnow.cc.gatech.edu/squeak/$1',0),
 79+('StrikiWiki','http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?$1',0),
 80+('SVGWiki','http://www.protocol7.com/svg-wiki/default.asp?$1',0),
 81+('Tavi','http://tavi.sourceforge.net/index.php?$1',0),
 82+('TmNet','http://www.technomanifestos.net/?$1',0),
 83+('TMwiki','http://www.EasyTopicMaps.com/?page=$1',0),
 84+('TWiki','http://twiki.org/cgi-bin/view/$1',0),
 85+('TwistedWiki','http://purl.net/wiki/twisted/$1',0),
 86+('Unreal','http://wiki.beyondunreal.com/wiki/$1',0),
 87+('UseMod','http://www.usemod.com/cgi-bin/wiki.pl?$1',0),
 88+('VisualWorks','http://wiki.cs.uiuc.edu/VisualWorks/$1',0),
 89+('WebDevWikiNL','http://www.promo-it.nl/WebDevWiki/index.php?page=$1',0),
 90+('WebSeitzWiki','http://webseitz.fluxent.com/wiki/$1',0),
 91+('Why','http://clublet.com/c/c/why?$1',0),
 92+('Wiki','http://c2.com/cgi/wiki?$1',0),
 93+('WikiPedia','http://www.wikipedia.org/wiki/$1',0),
 94+('Wiktionary','http://wiktionary.org/wiki/$1',0),
 95+('WikiWorld','http://WikiWorld.com/wiki/index.php/$1',0),
 96+('YpsiEyeball','http://sknkwrks.dyndns.org:1957/writewiki/wiki.pl?$1',0),
 97+('ZWiki','http://www.zwiki.org/$1',0),
 98+('ReVo','http://purl.org/NET/voko/revo/art/$1.html',0),
 99+('EcheI','http://www.ikso.net/cgi-bin/wiki.pl?$1',0),
 100+('EĉeI','http://www.ikso.net/cgi-bin/wiki.pl?$1',0),
 101+('JEFO','http://esperanto.jeunes.free.fr/vikio/index.php?$1',0),
 102+('PMEG','http://www.bertilow.com/pmeg/$1.php',0),
 103+('EnciclopediaLibre','http://enciclopedia.us.es/wiki.phtml?title=$1',0);
 104+
Property changes on: trunk/phase3/maintenance/interwiki.sql
___________________________________________________________________
Added: svn:eol-style
1105 + native
Added: svn:keywords
2106 + Author Date Id Revision
Index: trunk/phase3/maintenance/wikipedia-interwiki.sql
@@ -0,0 +1,147 @@
 2+-- For convenience, here are the *in-project* interwiki prefixes
 3+-- for Wikipedia.
 4+
 5+REPLACE INTO interwiki (iw_prefix,iw_url,iw_local) VALUES
 6+('w','http://www.wikipedia.org/wiki/$1',1),
 7+('m','http://meta.wikipedia.org/wiki/$1',1),
 8+('meta','http://meta.wikipedia.org/wiki/$1',1),
 9+('sep11','http://sep11.wikipedia.org/wiki/$1',1),
 10+('simple','http://simple.wikipedia.com/wiki.cgi?$1',1),
 11+('aa','http://aa.wikipedia.com/wiki.cgi?$1',1),
 12+('ab','http://ab.wikipedia.com/wiki.cgi?$1',1),
 13+('af','http://af.wikipedia.com/wiki.cgi?$1',1),
 14+('am','http://am.wikipedia.com/wiki.cgi?$1',1),
 15+('ar','http://ar.wikipedia.org/wiki/$1',1),
 16+('as','http://as.wikipedia.com/wiki.cgi?$1',1),
 17+('ay','http://ay.wikipedia.com/wiki.cgi?$1',1),
 18+('az','http://az.wikipedia.com/wiki.cgi?$1',1),
 19+('ba','http://ba.wikipedia.com/wiki.cgi?$1',1),
 20+('be','http://be.wikipedia.com/wiki.cgi?$1',1),
 21+('bh','http://bh.wikipedia.com/wiki.cgi?$1',1),
 22+('bi','http://bi.wikipedia.com/wiki.cgi?$1',1),
 23+('bn','http://bn.wikipedia.com/wiki.cgi?$1',1),
 24+('bs','http://bs.wikipedia.org/wiki/$1',1),
 25+('bo','http://bo.wikipedia.com/wiki.cgi?$1',1),
 26+('ca','http://ca.wikipedia.com/wiki.cgi?$1',1),
 27+('co','http://co.wikipedia.com/wiki.cgi?$1',1),
 28+('cs','http://cs.wikipedia.org/wiki/$1',1),
 29+('cy','http://cy.wikipedia.org/wiki/$1',1),
 30+('da','http://da.wikipedia.org/wiki/$1',1),
 31+('de','http://de.wikipedia.org/wiki/$1',1),
 32+('dk','http://da.wikipedia.org/wiki/$1',1),
 33+('dz','http://dz.wikipedia.com/wiki.cgi?$1',1),
 34+('el','http://el.wikipedia.org/wiki/$1',1),
 35+('en','http://www.wikipedia.org/wiki/$1',1),
 36+('eo','http://eo.wikipedia.org/wiki/$1',1),
 37+('es','http://es.wikipedia.org/wiki/$1',1),
 38+('et','http://et.wikipedia.com/wiki.cgi?$1',1),
 39+('eu','http://eu.wikipedia.com/wiki.cgi?$1',1),
 40+('fa','http://fa.wikipedia.com/wiki.cgi?$1',1),
 41+('fi','http://fi.wikipedia.com/wiki.cgi?$1',1),
 42+('fj','http://fj.wikipedia.com/wiki.cgi?$1',1),
 43+('fo','http://fo.wikipedia.com/wiki.cgi?$1',1),
 44+('fr','http://fr.wikipedia.org/wiki/$1',1),
 45+('fy','http://fy.wikipedia.com/wiki.cgi?$1',1),
 46+('ga','http://ga.wikipedia.com/wiki.cgi?$1',1),
 47+('gl','http://gl.wikipedia.com/wiki.cgi?$1',1),
 48+('gn','http://gn.wikipedia.com/wiki.cgi?$1',1),
 49+('gu','http://gu.wikipedia.com/wiki.cgi?$1',1),
 50+('ha','http://ha.wikipedia.com/wiki.cgi?$1',1),
 51+('he','http://he.wikipedia.org/wiki/$1',1),
 52+('hi','http://hi.wikipedia.org/wiki/$1',1),
 53+('hr','http://hr.wikipedia.org/wiki/$1',1),
 54+('hu','http://hu.wikipedia.org/wiki/$1',1),
 55+('hy','http://hy.wikipedia.com/wiki.cgi?$1',1),
 56+('ia','http://ia.wikipedia.com/wiki.cgi?$1',1),
 57+('id','http://id.wikipedia.com/wiki.cgi?$1',1),
 58+('ik','http://ik.wikipedia.com/wiki.cgi?$1',1),
 59+('is','http://is.wikipedia.com/wiki.cgi?$1',1),
 60+('it','http://it.wikipedia.com/wiki.cgi?$1',1),
 61+('iu','http://iu.wikipedia.com/wiki.cgi?$1',1),
 62+('ja','http://ja.wikipedia.org/wiki/$1',1),
 63+('jv','http://jv.wikipedia.com/wiki.cgi?$1',1),
 64+('ka','http://ka.wikipedia.com/wiki.cgi?$1',1),
 65+('kk','http://kk.wikipedia.com/wiki.cgi?$1',1),
 66+('kl','http://kl.wikipedia.com/wiki.cgi?$1',1),
 67+('km','http://km.wikipedia.com/wiki.cgi?$1',1),
 68+('kn','http://kn.wikipedia.com/wiki.cgi?$1',1),
 69+('ko','http://ko.wikipedia.org/wiki/$1',1),
 70+('ks','http://ks.wikipedia.com/wiki.cgi?$1',1),
 71+('ku','http://ku.wikipedia.com/wiki.cgi?$1',1),
 72+('ky','http://ky.wikipedia.com/wiki.cgi?$1',1),
 73+('la','http://la.wikipedia.com/wiki.cgi?$1',1),
 74+('lo','http://lo.wikipedia.com/wiki.cgi?$1',1),
 75+('lv','http://lv.wikipedia.com/wiki.cgi?$1',1),
 76+('mg','http://mg.wikipedia.com/wiki.cgi?$1',1),
 77+('mi','http://mi.wikipedia.com/wiki.cgi?$1',1),
 78+('mk','http://mk.wikipedia.com/wiki.cgi?$1',1),
 79+('ml','http://ml.wikipedia.org/wiki/$1',1),
 80+('mn','http://mn.wikipedia.com/wiki.cgi?$1',1),
 81+('mo','http://mo.wikipedia.com/wiki.cgi?$1',1),
 82+('mr','http://mr.wikipedia.com/wiki.cgi?$1',1),
 83+('ms','http://ms.wikipedia.org/wiki/$1',1),
 84+('my','http://my.wikipedia.com/wiki.cgi?$1',1),
 85+('na','http://na.wikipedia.com/wiki.cgi?$1',1),
 86+('nah','http://nah.wikipedia.org/wiki/$1',1),
 87+('ne','http://ne.wikipedia.com/wiki.cgi?$1',1),
 88+('nl','http://nl.wikipedia.org/wiki/$1',1),
 89+('no','http://no.wikipedia.com/wiki.cgi?$1',1),
 90+('oc','http://oc.wikipedia.com/wiki.cgi?$1',1),
 91+('om','http://om.wikipedia.com/wiki.cgi?$1',1),
 92+('or','http://or.wikipedia.com/wiki.cgi?$1',1),
 93+('pa','http://pa.wikipedia.com/wiki.cgi?$1',1),
 94+('pl','http://pl.wikipedia.org/wiki/$1',1),
 95+('ps','http://ps.wikipedia.com/wiki.cgi?$1',1),
 96+('pt','http://pt.wikipedia.com/wiki.cgi?$1',1),
 97+('qu','http://qu.wikipedia.com/wiki.cgi?$1',1),
 98+('rm','http://rm.wikipedia.com/wiki.cgi?$1',1),
 99+('rn','http://rn.wikipedia.com/wiki.cgi?$1',1),
 100+('ro','http://ro.wikipedia.org/wiki/$1',1),
 101+('ru','http://ru.wikipedia.org/wiki/$1',1),
 102+('rw','http://rw.wikipedia.com/wiki.cgi?$1',1),
 103+('sa','http://sa.wikipedia.com/wiki.cgi?$1',1),
 104+('sd','http://sd.wikipedia.com/wiki.cgi?$1',1),
 105+('sg','http://sg.wikipedia.com/wiki.cgi?$1',1),
 106+('sh','http://sh.wikipedia.org/wiki/$1',1),
 107+('si','http://si.wikipedia.com/wiki.cgi?$1',1),
 108+('sk','http://sk.wikipedia.org/wiki/$1',1),
 109+('sl','http://sl.wikipedia.org/wiki/$1',1),
 110+('sm','http://sm.wikipedia.com/wiki.cgi?$1',1),
 111+('sn','http://sn.wikipedia.com/wiki.cgi?$1',1),
 112+('so','http://so.wikipedia.com/wiki.cgi?$1',1),
 113+('sq','http://sq.wikipedia.com/wiki.cgi?$1',1),
 114+('sr','http://sr.wikipedia.org/wiki/$1',1),
 115+('ss','http://ss.wikipedia.com/wiki.cgi?$1',1),
 116+('st','http://st.wikipedia.com/wiki.cgi?$1',1),
 117+('su','http://su.wikipedia.com/wiki.cgi?$1',1),
 118+('sv','http://sv.wikipedia.org/wiki/$1',1),
 119+('sw','http://sw.wikipedia.com/wiki.cgi?$1',1),
 120+('ta','http://ta.wikipedia.com/wiki.cgi?$1',1),
 121+('te','http://te.wikipedia.com/wiki.cgi?$1',1),
 122+('tg','http://tg.wikipedia.com/wiki.cgi?$1',1),
 123+('th','http://th.wikipedia.com/wiki.cgi?$1',1),
 124+('ti','http://ti.wikipedia.com/wiki.cgi?$1',1),
 125+('tk','http://tk.wikipedia.com/wiki.cgi?$1',1),
 126+('tl','http://tl.wikipedia.com/wiki.cgi?$1',1),
 127+('tn','http://tn.wikipedia.com/wiki.cgi?$1',1),
 128+('to','http://to.wikipedia.com/wiki.cgi?$1',1),
 129+('tr','http://tr.wikipedia.org/wiki/$1',1),
 130+('ts','http://ts.wikipedia.com/wiki.cgi?$1',1),
 131+('tt','http://tt.wikipedia.com/wiki.cgi?$1',1),
 132+('tw','http://tw.wikipedia.com/wiki.cgi?$1',1),
 133+('ug','http://ug.wikipedia.com/wiki.cgi?$1',1),
 134+('uk','http://uk.wikipedia.com/wiki.cgi?$1',1),
 135+('ur','http://ur.wikipedia.com/wiki.cgi?$1',1),
 136+('uz','http://uz.wikipedia.com/wiki.cgi?$1',1),
 137+('vi','http://vi.wikipedia.com/wiki.cgi?$1',1),
 138+('vo','http://vo.wikipedia.com/wiki.cgi?$1',1),
 139+('wo','http://wo.wikipedia.com/wiki.cgi?$1',1),
 140+('xh','http://xh.wikipedia.com/wiki.cgi?$1',1),
 141+('yi','http://yi.wikipedia.com/wiki.cgi?$1',1),
 142+('yo','http://yo.wikipedia.com/wiki.cgi?$1',1),
 143+('za','http://za.wikipedia.com/wiki.cgi?$1',1),
 144+('zh','http://zh.wikipedia.org/wiki/$1',1),
 145+('zh-cn','http://zh.wikipedia.org/wiki/$1',1),
 146+('zh-tw','http://zh.wikipedia.org/wiki/$1',1),
 147+('zu','http://zu.wikipedia.com/wiki.cgi?$1',1),
 148+('nds','http://nds.wikipedia.org/wiki.cgi?$1',1);
Property changes on: trunk/phase3/maintenance/wikipedia-interwiki.sql
___________________________________________________________________
Added: svn:eol-style
1149 + native
Added: svn:keywords
2150 + Author Date Id Revision
Index: trunk/phase3/maintenance/tables.sql
@@ -177,3 +177,11 @@
178178 UNIQUE KEY (si_page)
179179 ) TYPE=MyISAM PACK_KEYS=1;
180180
 181+DROP TABLE IF EXISTS interwiki;
 182+CREATE TABLE interwiki (
 183+ iw_prefix char(32) NOT NULL,
 184+ iw_url char(127) NOT NULL,
 185+ iw_local BOOL NOT NULL,
 186+ UNIQUE KEY iw_prefix (iw_prefix)
 187+);
 188+
Index: trunk/phase3/install.php
@@ -120,6 +120,7 @@
121121 dbsource( $rconn, "./maintenance/tables.sql" );
122122 dbsource( $rconn, "./maintenance/users.sql" );
123123 dbsource( $rconn, "./maintenance/initialdata.sql" );
 124+dbsource( $rconn, "./maintenance/interwiki.sql" );
124125
125126 populatedata(); # Needs internationalized messages
126127

Follow-up revisions

RevisionCommit summaryAuthorDate
r55401Delete maintenance/fetchInterwiki.pl - has been obsolete since r1589mrzman00:25, 21 August 2009
r114912Purge the cached value from memcached....platonides20:00, 15 April 2012

Status & tagging log