Download - Hacking Mediawiki
Jani Patokallio
Hacking MediaWiki
http://www.mediawiki.org/
MediaWiki/Wikimedia Wiki structure Wiki customisation
Outline
Open-source (GPL) wiki engine software (uses LAMP)
MediaWiki
Wikimedia
MediaWiki
US foundation that runs a
bunch of Wiki sites
(Wikipedia etc.)
Pages
Page A
Page B
Tied together by...
Links: AB
Wiki structure
Special:WhatLinksHere (BA)Special:RecentChangesLinked
(BC)Special:MostLinked
Special:WantedPages
Links
Help:Links
Links are fundamentally one-way (A to B), but Mediawiki gives a couple of tools for working out
Links Subpages
Wiki structure
Automated breadcrumbs up
A / B / C intoA B C
Subpages
Help:Subpages
Links Subpages Namespaces
Wiki structure
Front page + talk page Main, Project, Help, add more... Template Category Special* Image, Media* MediaWiki*(* = pseudo namespace)
Namespaces
Help:Namespaces
Special:RecentChangesSpecial:SpecialPages
Special pages
Help:Special pages
Categories
Help:Categories
Group together pages
Links Subpages Namespaces Categories Templates
Wiki structure
Page transclusion: {{foo}}, , {{subst:foo}}Parameters
Templates
Help:Templates
Special:ExpandTemplates
Special:ExpandTemplates
Look like {{CAPS TEMPLATES}}Especially used in templates - context. Time, revision related Stats!{{NUMBEROFARTICLES}}{{NUMBEROFEDITS}}{{NUMBEROFUSERS}}{{PAGESINCATEGORY:Foo}}
Magic words
Help:Magic words
Special:ListGroupRights
Anonymous/IP editor User Admin (Sysop) Bureaucrat Bot
User access levels
Manual:User rights
In the box configuration
MediaWiki: namespace
CSS
Outside the box programming
Gadgets
Extensions
Bots (API)
Wiki customisation
System [interface] messages
Edit MediaWiki: pages to overrridedefaults (sysops only)Search on Special:Allmessages to find the right message/page
MediaWiki namespace
Manual:System message
Users can customize their own view!
MediaWiki:Common.cssMediaWiki:Common.js
Monobook skin: (same for others)MediaWiki:Monobook.cssMediaWiki:Monobook.js
Look & feel
Massively simplify user JS/CSS sharing:no more copying user subpages
MediaWiki:Gadgets-definition-> New Preferences tab
JS/CSS Gadgets
Extension:Gadgets
MediaWiki:Gadgets-definition
MediaWiki:Gadget-section-browsing-gadgetsMediaWiki:Gadget-Navigation popupsList of file namesMediaWiki:Gadget-foo.js/css
Special:Preferences -> Gadgets
Make your edit box less scary:
Gadget rec: wikEd
http://enwp.org/WP:WIKED
The way to add random PHP code to
extend MediaWiki's functionality
~1500 already available Quality varies widely Stick to those
already live
on Wikimedia projects...
Extensions
Manual:Extensions
Adds Editor, Reviewer user classes Page revisions must be
approved
before they go live to public Comments and quality flags for
pages Being rolled out on
Wikipedia now
FlaggedRevs
Extension:FlaggedRevs
When categories aren't enough... Semantic tags in content
[[name::Melbourne]] [[place::city]]
[[pop::3609734]] SQL-type queries across content
{{#ask: [[place::city]]
[[pop::>1000000]]| ?name }}
Semantic Mediawiki
semanticmediawiki.org
A bot is really just a script/program
that connects to MediaWiki
Can do anything than a human can
Automatic running bot
Special flag can hide bot edits
Older bots used screen scraping
pymediawiki framework
Bots
Help:Bots
HTTP-based interface for (almost) all
MediaWiki operations
Flexible, tested and doesn't break
every time the Wiki skin changes
Wide range of language libraries
Ruby support pretty
poor though...
MediaWiki API
mediawiki.org/wiki/API
Query (XML) Parse (= render as HTML) Edit, delete, move Bulk import, export (again XML)
API operations
mediawiki.org/wiki/API
http://mediawiki.org is half-decent now Still lots of info on http://meta.wikimedia.org/ IRC is popular: irc://irc.freenode.net/mediawiki MLs: mediawiki-l Forum: http://mwusers.com/ (unofficial)
Support
Questions?
Jani Patokallio
Original slides by Brianna Laugher These slides are
dual-licensed GFDL1.2+, CC-BY-SA-3.0.
Screenshots are GFDL/GPL, WMF logo is all rights reserved,
MediaWiki logo is public domain.
Thank you!