r1696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r1695‎ | r1696 | r1697 >
Date:13:10, 21 September 2003
Author:(no author)
Status:old
Tags:
Comment:
This commit was manufactured by cvs2svn to create branch 'stable'.
Modified paths:
  • /branches/stable/phase3/docs/memcached.doc (added) (history)
  • /branches/stable/phase3/docs/memcached.doc (added) (history)
  • /branches/stable/phase3/includes/Math.php (added) (history)
  • /branches/stable/phase3/includes/Math.php (added) (history)
  • /branches/stable/phase3/maintenance/interwiki.sql (added) (history)
  • /branches/stable/phase3/maintenance/interwiki.sql (added) (history)
  • /branches/stable/phase3/maintenance/wikipedia-interwiki.sql (added) (history)
  • /branches/stable/phase3/maintenance/wikipedia-interwiki.sql (added) (history)

Diff [purge]

Index: branches/stable/phase3/maintenance/interwiki.sql
@@ -0,0 +1,111 @@
 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+('EcxeI','http://www.ikso.net/cgi-bin/wiki.pl?$1',0),
 101+('EĉeI','http://www.ikso.net/cgi-bin/wiki.pl?$1',0),
 102+('JEFO','http://www.esperanto-jeunes.org/vikio/index.php?$1',0),
 103+('PMEG','http://www.bertilow.com/pmeg/$1.php',0),
 104+('TEJO','http://www.tejo.org/vikio/$1',0),
 105+('USEJ','http://www.tejo.org/usej/$1',0),
 106+('UEA','http://www.tejo.org/uea/$1',0),
 107+('Turismo','http://www.tejo.org/turismo/$1',0),
 108+('GEJ','http://www.esperanto.de/cgi-bin/aktivikio/wiki.pl?$1',0),
 109+('BEMI','http://bemi.free.fr/vikio/index.php?$1',0),
 110+('EnciclopediaLibre','http://enciclopedia.us.es/wiki.phtml?title=$1',0),
 111+('WikiBooks','http://wikibooks.org/wiki/$1',0);
 112+
Property changes on: branches/stable/phase3/maintenance/interwiki.sql
___________________________________________________________________
Added: svn:eol-style
1113 + native
Added: svn:keywords
2114 + Author Date Id Revision
Index: branches/stable/phase3/maintenance/wikipedia-interwiki.sql
@@ -0,0 +1,150 @@
 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.org/wiki/$1',1),
 11+('aa','http://aa.wikipedia.org/wiki/$1',1),
 12+('ab','http://ab.wikipedia.org/wiki/$1',1),
 13+('af','http://af.wikipedia.org/wiki/$1',1),
 14+('am','http://am.wikipedia.org/wiki/$1',1),
 15+('ar','http://ar.wikipedia.org/wiki/$1',1),
 16+('as','http://as.wikipedia.org/wiki/$1',1),
 17+('ay','http://ay.wikipedia.org/wiki/$1',1),
 18+('az','http://az.wikipedia.org/wiki/$1',1),
 19+('ba','http://ba.wikipedia.org/wiki/$1',1),
 20+('be','http://be.wikipedia.org/wiki/$1',1),
 21+('bh','http://bh.wikipedia.org/wiki/$1',1),
 22+('bi','http://bi.wikipedia.org/wiki/$1',1),
 23+('bn','http://bn.wikipedia.org/wiki/$1',1),
 24+('bs','http://bs.wikipedia.org/wiki/$1',1),
 25+('bo','http://bo.wikipedia.org/wiki/$1',1),
 26+('ca','http://ca.wikipedia.org/wiki/$1',1),
 27+('co','http://co.wikipedia.org/wiki/$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.org/wiki/$1',1),
 34+('el','http://el.wikipedia.org/wiki/$1',1),
 35+('en','http://en.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.org/wiki/$1',1),
 39+('eu','http://eu.wikipedia.org/wiki/$1',1),
 40+('fa','http://fa.wikipedia.org/wiki/$1',1),
 41+('fi','http://fi.wikipedia.org/wiki/$1',1),
 42+('fj','http://fj.wikipedia.org/wiki/$1',1),
 43+('fo','http://fo.wikipedia.org/wiki/$1',1),
 44+('fr','http://fr.wikipedia.org/wiki/$1',1),
 45+('fy','http://fy.wikipedia.org/wiki/$1',1),
 46+('ga','http://ga.wikipedia.org/wiki/$1',1),
 47+('gd','http://gd.wikipedia.org/wiki/$1',1),
 48+('gl','http://gl.wikipedia.org/wiki/$1',1),
 49+('gn','http://gn.wikipedia.org/wiki/$1',1),
 50+('gu','http://gu.wikipedia.org/wiki/$1',1),
 51+('gv','http://gv.wikipedia.org/wiki/$1',1),
 52+('ha','http://ha.wikipedia.org/wiki/$1',1),
 53+('he','http://he.wikipedia.org/wiki/$1',1),
 54+('hi','http://hi.wikipedia.org/wiki/$1',1),
 55+('hr','http://hr.wikipedia.org/wiki/$1',1),
 56+('hu','http://hu.wikipedia.org/wiki/$1',1),
 57+('hy','http://hy.wikipedia.org/wiki/$1',1),
 58+('ia','http://ia.wikipedia.org/wiki/$1',1),
 59+('id','http://id.wikipedia.org/wiki/$1',1),
 60+('ik','http://ik.wikipedia.org/wiki/$1',1),
 61+('is','http://is.wikipedia.org/wiki/$1',1),
 62+('it','http://it.wikipedia.org/wiki/$1',1),
 63+('iu','http://iu.wikipedia.org/wiki/$1',1),
 64+('ja','http://ja.wikipedia.org/wiki/$1',1),
 65+('jv','http://jv.wikipedia.org/wiki/$1',1),
 66+('ka','http://ka.wikipedia.org/wiki/$1',1),
 67+('kk','http://kk.wikipedia.org/wiki/$1',1),
 68+('kl','http://kl.wikipedia.org/wiki/$1',1),
 69+('km','http://km.wikipedia.org/wiki/$1',1),
 70+('kn','http://kn.wikipedia.org/wiki/$1',1),
 71+('ko','http://ko.wikipedia.org/wiki/$1',1),
 72+('ks','http://ks.wikipedia.org/wiki/$1',1),
 73+('ku','http://ku.wikipedia.org/wiki/$1',1),
 74+('ky','http://ky.wikipedia.org/wiki/$1',1),
 75+('la','http://la.wikipedia.org/wiki/$1',1),
 76+('lo','http://lo.wikipedia.org/wiki/$1',1),
 77+('lv','http://lv.wikipedia.org/wiki/$1',1),
 78+('mg','http://mg.wikipedia.org/wiki/$1',1),
 79+('mi','http://mi.wikipedia.org/wiki/$1',1),
 80+('mk','http://mk.wikipedia.org/wiki/$1',1),
 81+('ml','http://ml.wikipedia.org/wiki/$1',1),
 82+('mn','http://mn.wikipedia.org/wiki/$1',1),
 83+('mo','http://mo.wikipedia.org/wiki/$1',1),
 84+('mr','http://mr.wikipedia.org/wiki/$1',1),
 85+('ms','http://ms.wikipedia.org/wiki/$1',1),
 86+('my','http://my.wikipedia.org/wiki/$1',1),
 87+('na','http://na.wikipedia.org/wiki/$1',1),
 88+('nah','http://nah.wikipedia.org/wiki/$1',1),
 89+('nds','http://nds.wikipedia.org/wiki/$1',1),
 90+('ne','http://ne.wikipedia.org/wiki/$1',1),
 91+('nl','http://nl.wikipedia.org/wiki/$1',1),
 92+('no','http://no.wikipedia.org/wiki/$1',1),
 93+('oc','http://oc.wikipedia.org/wiki/$1',1),
 94+('om','http://om.wikipedia.org/wiki/$1',1),
 95+('or','http://or.wikipedia.org/wiki/$1',1),
 96+('pa','http://pa.wikipedia.org/wiki/$1',1),
 97+('pl','http://pl.wikipedia.org/wiki/$1',1),
 98+('ps','http://ps.wikipedia.org/wiki/$1',1),
 99+('pt','http://pt.wikipedia.org/wiki/$1',1),
 100+('qu','http://qu.wikipedia.org/wiki/$1',1),
 101+('rm','http://rm.wikipedia.org/wiki/$1',1),
 102+('rn','http://rn.wikipedia.org/wiki/$1',1),
 103+('ro','http://ro.wikipedia.org/wiki/$1',1),
 104+('ru','http://ru.wikipedia.org/wiki/$1',1),
 105+('rw','http://rw.wikipedia.org/wiki/$1',1),
 106+('sa','http://sa.wikipedia.org/wiki/$1',1),
 107+('sd','http://sd.wikipedia.org/wiki/$1',1),
 108+('sg','http://sg.wikipedia.org/wiki/$1',1),
 109+('sh','http://sh.wikipedia.org/wiki/$1',1),
 110+('si','http://si.wikipedia.org/wiki/$1',1),
 111+('sk','http://sk.wikipedia.org/wiki/$1',1),
 112+('sl','http://sl.wikipedia.org/wiki/$1',1),
 113+('sm','http://sm.wikipedia.org/wiki/$1',1),
 114+('sn','http://sn.wikipedia.org/wiki/$1',1),
 115+('so','http://so.wikipedia.org/wiki/$1',1),
 116+('sq','http://sq.wikipedia.org/wiki/$1',1),
 117+('sr','http://sr.wikipedia.org/wiki/$1',1),
 118+('ss','http://ss.wikipedia.org/wiki/$1',1),
 119+('st','http://st.wikipedia.org/wiki/$1',1),
 120+('su','http://su.wikipedia.org/wiki/$1',1),
 121+('sv','http://sv.wikipedia.org/wiki/$1',1),
 122+('sw','http://sw.wikipedia.org/wiki/$1',1),
 123+('ta','http://ta.wikipedia.org/wiki/$1',1),
 124+('te','http://te.wikipedia.org/wiki/$1',1),
 125+('tg','http://tg.wikipedia.org/wiki/$1',1),
 126+('th','http://th.wikipedia.org/wiki/$1',1),
 127+('ti','http://ti.wikipedia.org/wiki/$1',1),
 128+('tk','http://tk.wikipedia.org/wiki/$1',1),
 129+('tl','http://tl.wikipedia.org/wiki/$1',1),
 130+('tn','http://tn.wikipedia.org/wiki/$1',1),
 131+('to','http://to.wikipedia.org/wiki/$1',1),
 132+('tr','http://tr.wikipedia.org/wiki/$1',1),
 133+('ts','http://ts.wikipedia.org/wiki/$1',1),
 134+('tt','http://tt.wikipedia.org/wiki/$1',1),
 135+('tw','http://tw.wikipedia.org/wiki/$1',1),
 136+('ug','http://ug.wikipedia.org/wiki/$1',1),
 137+('uk','http://uk.wikipedia.org/wiki/$1',1),
 138+('ur','http://ur.wikipedia.org/wiki/$1',1),
 139+('uz','http://uz.wikipedia.org/wiki/$1',1),
 140+('vi','http://vi.wikipedia.org/wiki/$1',1),
 141+('vo','http://vo.wikipedia.org/wiki/$1',1),
 142+('wo','http://wo.wikipedia.org/wiki/$1',1),
 143+('xh','http://xh.wikipedia.org/wiki/$1',1),
 144+('yi','http://yi.wikipedia.org/wiki/$1',1),
 145+('yo','http://yo.wikipedia.org/wiki/$1',1),
 146+('za','http://za.wikipedia.org/wiki/$1',1),
 147+('zh','http://zh.wikipedia.org/wiki/$1',1),
 148+('zh-cn','http://zh.wikipedia.org/wiki/$1',1),
 149+('zh-tw','http://zh.wikipedia.org/wiki/$1',1),
 150+('zu','http://zu.wikipedia.org/wiki/$1',1);
 151+
Property changes on: branches/stable/phase3/maintenance/wikipedia-interwiki.sql
___________________________________________________________________
Added: svn:eol-style
1152 + native
Added: svn:keywords
2153 + Author Date Id Revision
Index: branches/stable/phase3/docs/memcached.doc
@@ -0,0 +1,119 @@
 2+memcached support for MediaWiki:
 3+
 4+From ca August 2003, MediaWiki has optional support for memcached, a
 5+"high-performance, distributed memory object caching system".
 6+For general information on it, see: http://www.danga.com/memcached/
 7+
 8+Memcached is likely more trouble than a small site will need, but
 9+for a larger site with heavy load, like Wikipedia, it should help
 10+lighten the load on the database servers by caching data and objects
 11+in memory.
 12+
 13+== Requirements ==
 14+
 15+* PHP must be compiled with --enable-sockets
 16+
 17+* libevent: http://www.monkey.org/~provos/libevent/
 18+ (as of 2003-08-11, 0.7a is current)
 19+
 20+* optionally, epoll-rt patch for Linux kernel:
 21+ http://www.xmailserver.org/linux-patches/nio-improve.html
 22+
 23+* memcached: http://www.danga.com/memcached/download.bml
 24+ (as of this writing, 1.1.9 is current)
 25+
 26+Memcached and libevent are under BSD-style licenses.
 27+
 28+The server should run on Linux and other Unix-like systems... you
 29+can run multiple servers on one machine or on multiple machines on
 30+a network; storage can be distributed across multiple servers, and
 31+multiple web servers can use the same cache cluster.
 32+
 33+
 34+********************* W A R N I N G ! ! ! ! ! ***********************
 35+Memcached has no security or authentication. Please ensure that your
 36+server is appropriately firewalled, and that the port(s) used for
 37+memcached servers are not publicly accessible. Otherwise, anyone on
 38+the internet can put data into and read data from your cache.
 39+
 40+An attacker familiar with MediaWiki internals could use this to give
 41+themselves developer access and delete all data from the wiki's
 42+database, as well as getting all users' password hashes and e-mail
 43+addresses.
 44+********************* W A R N I N G ! ! ! ! ! ***********************
 45+
 46+== Setup ==
 47+
 48+If you want to start small, just run one memcached on your web
 49+server:
 50+
 51+ memcached -d -l 127.0.0.1 -p 11000 -m 64
 52+
 53+(to run in daemon mode, accessible only via loopback interface,
 54+on port 11000, using up to 64MB of memory)
 55+
 56+In your LocalSettings.php file, set:
 57+
 58+ $wgUseMemCached = true;
 59+ $wgMemCachedServers = array( "127.0.0.1:11000" );
 60+
 61+The wiki should then use memcached to cache various data. To use
 62+multiple servers (physically separate boxes or multiple caches
 63+on one machine on a large-memory x86 box), just add more items
 64+to the array. To increase the weight of a server (say, because
 65+it has twice the memory of the others and you want to spread
 66+usage evenly), make its entry a subarray:
 67+
 68+ $wgMemCachedServers = array(
 69+ "127.0.0.1:11000", # one gig on this box
 70+ array("192.168.0.1:11000", 2) # two gigs on the other box
 71+ );
 72+
 73+
 74+== PHP client for memcached ==
 75+
 76+As of this writing, MediaWiki includes version 1.0.10 of the PHP
 77+memcached client by Ryan Gilfether <hotrodder@rocketmail.com>.
 78+You'll find some documentation for it in the 'php-memcached'
 79+subdirectory under the present one.
 80+
 81+We intend to track updates, but if you want to check for the lastest
 82+released version, see http://www.danga.com/memcached/apis.bml
 83+
 84+If you don't set $wgUseMemCached, we still create a MemCacheClient,
 85+but requests to it are no-ops and we always fall through to the
 86+database. If the cache daemon can't be contacted, it should also
 87+disable itself fairly smoothly.
 88+
 89+== Keys used ==
 90+
 91+User:
 92+ key: $wgDBname:user:id:$sId
 93+ ex: wikidb:user:id:51
 94+ stores: instance of class User
 95+ set in: User::loadFromSession()
 96+ cleared by: User::saveSettings(), UserTalkUpdate::doUpdate()
 97+
 98+Newtalk:
 99+ key: $wgDBname:newtalk:ip:$ip
 100+ ex: wikidb:newtalk:ip:123.45.67.89
 101+ stores: integer, 0 or 1
 102+ set in: User::loadFromDatabase()
 103+ cleared by: User::saveSettings() # ?
 104+ expiry set to 30 minutes
 105+
 106+LinkCache:
 107+ key: $wgDBname:lc:title:$title
 108+ ex: wikidb:lc:title:Wikipedia:Welcome,_Newcomers!
 109+ stores: cur_id of page, or 0 if page does not exist
 110+ set in: LinkCache::addLink()
 111+ cleared by: LinkCache::clearBadLink()
 112+ should be cleared on page deletion and rename
 113+MediaWiki namespace:
 114+ key: $wgDBname:MediaWiki:title:$title
 115+ ex: wikidb:MediaWiki:title:Blockedtext
 116+ stores: string
 117+ set in: wfMsg()
 118+ cleared by: Article::editUpdates()
 119+
 120+... more to come ...
Property changes on: branches/stable/phase3/docs/memcached.doc
___________________________________________________________________
Added: svn:eol-style
1121 + native
Added: svn:keywords
2122 + Author Date Id Revision
Index: branches/stable/phase3/includes/Math.php
@@ -0,0 +1,116 @@
 2+<?
 3+
 4+function linkToMathImage ( $tex, $outputhash )
 5+{
 6+ global $wgMathPath;
 7+ return "<img src=\"".$wgMathPath."/".$outputhash.".png\" alt=\"".wfEscapeHTML($tex)."\">";
 8+}
 9+
 10+function renderMath( $tex )
 11+{
 12+ global $wgUser, $wgMathDirectory, $wgTmpDirectory, $wgInputEncoding;
 13+ $mf = wfMsg( "math_failure" );
 14+ $munk = wfMsg( "math_unknown_error" );
 15+
 16+ $fname = "renderMath";
 17+
 18+ $math = $wgUser->getOption("math");
 19+ if ($math == 3)
 20+ return ('$ '.wfEscapeHTML($tex).' $');
 21+
 22+ $md5 = md5($tex);
 23+ $md5_sql = mysql_escape_string(pack("H32", $md5));
 24+ if ($math == 0)
 25+ $sql = "SELECT math_outputhash FROM math WHERE math_inputhash = '".$md5_sql."'";
 26+ else
 27+ $sql = "SELECT math_outputhash,math_html_conservativeness,math_html FROM math WHERE math_inputhash = '".$md5_sql."'";
 28+
 29+ $res = wfQuery( $sql, DB_READ, $fname );
 30+ if ( wfNumRows( $res ) == 0 )
 31+ {
 32+ $cmd = "./math/texvc ".escapeshellarg($wgTmpDirectory)." ".
 33+ escapeshellarg($wgMathDirectory)." ".escapeshellarg($tex)." ".escapeshellarg($wgInputEncoding);
 34+ $contents = `$cmd`;
 35+
 36+ if (strlen($contents) == 0)
 37+ return "<b>".$mf." (".$munk."): ".wfEscapeHTML($tex)."</b>";
 38+ $retval = substr ($contents, 0, 1);
 39+ if (($retval == "C") || ($retval == "M") || ($retval == "L")) {
 40+ if ($retval == "C")
 41+ $conservativeness = 2;
 42+ else if ($retval == "M")
 43+ $conservativeness = 1;
 44+ else
 45+ $conservativeness = 0;
 46+ $outdata = substr ($contents, 33);
 47+
 48+ $i = strpos($outdata, "\000");
 49+
 50+ $outhtml = substr($outdata, 0, $i);
 51+ $mathml = substr($outdata, $i+1);
 52+
 53+ $sql_html = "'".mysql_escape_string($outhtml)."'";
 54+ $sql_mathml = "'".mysql_escape_string($mathml)."'";
 55+ } else if (($retval == "c") || ($retval == "m") || ($retval == "l")) {
 56+ $outhtml = substr ($contents, 33);
 57+ if ($retval == "c")
 58+ $conservativeness = 2;
 59+ else if ($retval == "m")
 60+ $conservativeness = 1;
 61+ else
 62+ $conservativeness = 0;
 63+ $sql_html = "'".mysql_escape_string($outhtml)."'";
 64+ $mathml = '';
 65+ $sql_mathml = 'NULL';
 66+ } else if ($retval == "X") {
 67+ $outhtml = '';
 68+ $mathml = substr ($contents, 33);
 69+ $sql_html = 'NULL';
 70+ $sql_mathml = "'".mysql_escape_string($mathml)."'";
 71+ $conservativeness = 0;
 72+ } else if ($retval == "+") {
 73+ $outhtml = '';
 74+ $mathml = '';
 75+ $sql_html = 'NULL';
 76+ $sql_mathml = 'NULL';
 77+ $conservativeness = 0;
 78+ } else {
 79+ if ($retval == "E")
 80+ $errmsg = wfMsg( "math_lexing_error" );
 81+ else if ($retval == "S")
 82+ $errmsg = wfMsg( "math_syntax_error" );
 83+ else if ($retval == "F")
 84+ $errmsg = wfMsg( "math_unknown_function" );
 85+ else
 86+ $errmsg = $munk;
 87+ return "<h3>".$mf." (".$errmsg.substr($contents, 1)."): ".wfEscapeHTML($tex)."</h3>";
 88+ }
 89+
 90+ $outmd5 = substr ($contents, 1, 32);
 91+ if (!preg_match("/^[a-f0-9]{32}$/", $outmd5))
 92+ return "<b>".$mf." (".$munk."): ".wfEscapeHTML($tex)."</b>";
 93+
 94+ $outmd5_sql = mysql_escape_string(pack("H32", $outmd5));
 95+
 96+ $sql = "REPLACE INTO math VALUES ('".$md5_sql."', '".$outmd5_sql."', ".$conservativeness.", ".$sql_html.", ".$sql_mathml.")";
 97+
 98+ $res = wfQuery( $sql, DB_WRITE, $fname );
 99+ # we don't really care if it fails
 100+
 101+ if (($math == 0) || ($rpage->math_html == '') || (($math == 1) && ($conservativeness != 2)) || (($math == 4) && ($conservativeness == 0)))
 102+ return linkToMathImage($tex, $outmd5);
 103+ else
 104+ return $outhtml;
 105+ } else {
 106+ $rpage = wfFetchObject ( $res );
 107+ $outputhash = unpack( "H32md5", $rpage->math_outputhash . " " );
 108+ $outputhash = $outputhash ['md5'];
 109+
 110+ if (($math == 0) || ($rpage->math_html == '') || (($math == 1) && ($rpage->math_html_conservativeness != 2)) || (($math == 4) && ($rpage->math_html_conservativeness == 0)))
 111+ return linkToMathImage ( $tex, $outputhash );
 112+ else
 113+ return $rpage->math_html;
 114+ }
 115+}
 116+
 117+?>
Property changes on: branches/stable/phase3/includes/Math.php
___________________________________________________________________
Added: svn:eol-style
1118 + native
Added: svn:keywords
2119 + Author Date Id Revision

Status & tagging log