Hacking MediaWiki (For Users)

5,929 views
5,789 views

Published on

Slides from this video: http://blip.tv/file/1504861

Talk given at the Linux Users of Victoria November 2008 meeting, about MediaWiki.

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
5,929
On SlideShare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
86
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Hacking MediaWiki (For Users)

  1. 1. Hacking MediaWiki  (For Users) Brianna Laugher Linux Users of Victoria November 2008 meeting http://www.mediawiki.org/
  2. 2. Who are we? ●  Me: 2005—now Wikimedia editor,    Wikimedia Commons administrator   ~ 2 years, frustrated wannabe hacker ●  You: Use MediaWiki outside of    Wikimedia, comfortable   with basic editing
  3. 3. Outline ●  MediaWiki/Wikimedia ●  Wiki structure ●  Magic words, access levels ●  User JS/CSS – Gadgets ●  “Uselang” hack
  4. 4. MediaWiki Open­source (GPL) wiki engine  software (uses LAMP) Wikimedia Name of a social movement;  also US charity  (Wikimedia  Foundation)
  5. 5. Wiki structure ●  Subpages
  6. 6. Subpages By default only in  talk, user pages Help:Subpages
  7. 7. Wiki structure ●  Subpages ●  Links
  8. 8. Links Special:MostLinked Special:WhatLinksHere Special:RecentChangesLinked Special:WantedPages Help:Links
  9. 9. Wiki structure ●  Subpages ●  Links ●  Categories
  10. 10. Categories Nine special pages for categories Help:Categories
  11. 11. Wiki structure ●  Subpages ●  Links ●  Categories ●  Templates
  12. 12. Templates Page transclusion: {{foo}} <noinclude>,  <includeonly>,   {{subst:foo}} Parameters Help:Templates
  13. 13. Special:ExpandTemplates
  14. 14. Special:ExpandTemplates
  15. 15. Wiki structure ●  Subpages ●  Links ●  Categories ●  Templates ●  Namespaces
  16. 16. Namespaces “Front” page + talk page ●  Main, Project, Help ●  Template ●  Category ●  Special* ●  Image, Media* ●  MediaWiki (* = psuedo namespace) Help:Namespaces
  17. 17. Special pages Special:RecentChanges Special:SpecialPages Help:Special pages
  18. 18. Images (uploaded files) Special:Upload Image namespace ­> File (soon!) [[Image:foo.jpg]] to embed [[:Image:foo.jpg]] to link to image page,                            not embed [[Media:foo.jpg]] to link to file directly
  19. 19. MediaWiki namespace “System [interface] messages” Edit MediaWiki: pages to overrride defaults (sysops only) Search on Special:Allmessages to  find the right message/page Manual:System message
  20. 20. Interesting pages MediaWiki:sidebar MediaWiki:welcomecreation MediaWiki:copyrightwarning, 2 MediaWiki:searchresulttext MediaWiki:uploadtext
  21. 21. About the sidebar... Manual:Interface/Sidebar
  22. 22. About the sidebar... Move search box to top for usability
  23. 23. About the sidebar... Move search box to top for usability MediaWiki:Mainpage Main Page
  24. 24. About the sidebar... Move search box to top for usability MediaWiki:Mainpage Main Page Delete defaults, Add your own links
  25. 25. Look & feel MediaWiki:Common.css MediaWiki:Common.js Monobook skin: (same for others) MediaWiki:Monobook.css MediaWiki:Monobook.js
  26. 26. Skins – roll your own Modify an existing one: User:Foo/monobook.css,js Your Name of skin. user Must start with page lowercase Myskin – empty to start with
  27. 27. Magic words “Behaviour switches”: __NOTOC__,__TOC__ #REDIRECT [[Foo]] __HIDDENCAT__ (on category pages) Help:Magic words
  28. 28. __HIDDENCAT__ Help:Magic words
  29. 29. Variables Look like {{CAPS TEMPLATES}} Especially used in templates ­ context. ●  Time, revision related ●  Stats! {{NUMBEROFARTICLES}} {{NUMBEROFEDITS}} {{NUMBEROFUSERS}} {{PAGESINCATEGORY:Foo}} Help:Magic words
  30. 30. User access levels Special:ListGroupRights ●  “Anonymous”/IP editor ●  (registered) User ●  ­> Autoconfirmed! ●  Sysop (==”admin”) ●  Bureaucrat ●  Bot Manual:User rights
  31. 31. Autoconfirmed? Time ­ $wgAutoConfirmAge Edit count ­ $wgAutoConfirmCount After passing both, User automatically graduates to Autoconfirmed (On Wikipedia thought to  be ~ 4 days)
  32. 32. Semi/protection Manual:Administrators
  33. 33. Semi/protection AND non- autoconfirmed users! Manual:Administrators
  34. 34. JS/CSS Gadgets Massively simplify user JS/CSS sharing: no more copying user subpages MediaWiki:Gadgets­definition ­> New Preferences tab Extension:Gadgets
  35. 35. MediaWiki:Gadgets­definition MediaWiki:Gadget-section-browsing-gadgets MediaWiki:Gadget-Navigation popups List of file names MediaWiki:Gadget-foo.js/css
  36. 36. Special:Preferences ­> Gadgets
  37. 37. Gadget rec: HotCat Instead of this: [[Category:Melbourne Cricket Ground]] Try this: http://commons.wikimedia.org/wiki/ MediaWiki:Gadget­HotCat.js
  38. 38. Gadget rec: wikEd Make your edit box less scary: http://enwp.org/WP:WIKED
  39. 39. “Uselang” hack (This is not really recommended...) Use it to make different versions of special pages,  eg upload form Uselang parameter overrides user language prefs Special:Upload?uselang=fr – I can see the  French version of the form without changing  my prefs http://commons.wikimedia.org/wiki/ Commons:Redesigning_the_upload_form
  40. 40. “Uselang” hack What if I make a link to  Special:Upload?uselang=blah ? For each message 'Foo', MW checks ●  MediaWiki:Foo/blah (localised message)  ●  MediaWiki:Foo (localised default wiki lang                                message) ●  MessagesBlah.php file (MW defaults) http://commons.wikimedia.org/wiki/ Commons:Redesigning_the_upload_form
  41. 41. Support  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)
  42. 42. Thankyou! Questions? 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.  http://brianna.modernthings.org/

×