Hacking Mediawiki


Published on

The structure of pages within MediaWiki (subpages, namespaces, categories, templates etc) and how to customize the look and feel (CSS, Gadgets), internals (Extensions) and content (API, bots).

Based on "Hacking Mediawiki (For Users)" by Brianna Laugher.


Published in: Technology
1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Links are fundamentally one-way (A to B), but Mediawiki gives a couple of tools for working out
  • Hacking Mediawiki

    1. 1. Jani Patokallio Hacking MediaWiki http://www.mediawiki.org/
    2. 2. MediaWiki/Wikimedia Wiki structure Wiki customisation Outline
    3. 3. Open-source (GPL) wiki engine software (uses LAMP) MediaWiki Wikimedia MediaWiki US foundation that runs a bunch of Wiki sites (Wikipedia etc.)
    4. 4. <ul><li>Pages </li></ul><ul><ul><li>“ Page A” </li></ul></ul><ul><ul><li>“ Page B” </li></ul></ul><ul><li>Tied together by... </li></ul><ul><ul><li>Links: A-> B </li></ul></ul>Wiki structure
    5. 5. Special:WhatLinksHere (B-> A) Special:RecentChangesLinked (B-> C) Special:MostLinked Special:WantedPages Links Help:Links
    6. 6. Links Subpages Wiki structure
    7. 7. Automated breadcrumbs “up” A / B / C into A ← B ← C Subpages Help:Subpages
    8. 8. Links Subpages Namespaces Wiki structure
    9. 9. “ Front” page + talk page Main, Project, Help, add more... Template Category Special* Image, Media* MediaWiki* (* = pseudo namespace) Namespaces Help:Namespaces
    10. 10. Special:RecentChanges Special:SpecialPages Special pages Help:Special pages
    11. 11. Categories Help:Categories Group together pages
    12. 13. Links Subpages Namespaces Categories Templates Wiki structure
    13. 14. Page transclusion: {{foo}} <noinclude>, <includeonly>, {{subst:foo}} Parameters Templates Help:Templates
    14. 17. Special:ExpandTemplates
    15. 18. Special:ExpandTemplates
    16. 19. Look like {{CAPS TEMPLATES}} Especially used in templates - context. Time, revision related Stats! {{NUMBEROFARTICLES}} {{NUMBEROFEDITS}} {{NUMBEROFUSERS}} {{PAGESINCATEGORY:Foo}} Magic words Help:Magic words
    17. 20. Special:ListGroupRights “ Anonymous”/IP editor User Admin (Sysop) Bureaucrat Bot User access levels Manual:User rights
    18. 21. <ul><li>In the box – configuration </li></ul><ul><ul><li>MediaWiki: namespace </li></ul></ul><ul><ul><li>CSS </li></ul></ul><ul><li>Outside the box – programming </li></ul><ul><ul><li>Gadgets </li></ul></ul><ul><ul><li>Extensions </li></ul></ul><ul><ul><li>Bots (API) </li></ul></ul>Wiki customisation
    19. 22. “ System [interface] messages” Edit MediaWiki: pages to overrride defaults (sysops only) Search on Special:Allmessages to find the right message/page MediaWiki namespace Manual:System message
    20. 24. Users can customize their own view! MediaWiki:Common.css MediaWiki:Common.js Monobook skin: (same for others) MediaWiki:Monobook.css MediaWiki:Monobook.js Look & feel
    21. 25. Massively simplify user JS/CSS sharing: no more copying user subpages MediaWiki:Gadgets-definition -> New Preferences tab JS/CSS Gadgets Extension:Gadgets
    22. 26. MediaWiki:Gadgets-definition MediaWiki:Gadget-section-browsing-gadgets MediaWiki:Gadget-Navigation popups List of file names MediaWiki:Gadget-foo.js/css
    23. 27. Special:Preferences -> Gadgets
    24. 28. Make your edit box less scary: Gadget rec: wikEd http://enwp.org/WP:WIKED
    25. 29. 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
    26. 30. 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
    27. 31. 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
    28. 32. <ul><li>A “bot” is really just a script/program that connects to MediaWiki </li></ul><ul><li>Can do anything than a human can </li></ul><ul><ul><li>Automatic running -> “bot” </li></ul></ul><ul><ul><li>Special flag can hide bot edits </li></ul></ul><ul><li>Older bots used screen scraping </li></ul><ul><ul><li>pymediawiki framework </li></ul></ul>Bots Help:Bots
    29. 33. <ul><li>HTTP-based interface for (almost) all MediaWiki operations </li></ul><ul><li>Flexible, tested and doesn't break every time the Wiki skin changes </li></ul><ul><li>Wide range of language libraries </li></ul><ul><ul><li>Ruby support pretty poor though... </li></ul></ul>MediaWiki API mediawiki.org/wiki/API
    30. 34. Query (XML) Parse (= render as HTML) Edit, delete, move Bulk import, export (again XML) API operations mediawiki.org/wiki/API
    31. 35. 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
    32. 36. Questions? Jani Patokallio <jani@contentshare.sg> Original slides by Brianna Laugher <brianna@modernthings.org> 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!