hacking mediawiki (for users)
DESCRIPTION
Slides from this video: http://blip.tv/file/1504861 Talk given at the Linux Users of Victoria November 2008 meeting, about MediaWiki.TRANSCRIPT
Brianna LaugherLinux Users of VictoriaNovember 2008 meeting
Hacking MediaWiki (For Users)
http://www.mediawiki.org/
● Me: 2005—now Wikimedia editor, Wikimedia Commons administrator ~ 2 years, frustrated wannabe hacker
● You: Use MediaWiki outside of Wikimedia, comfortable with basic editing
Who are we?
● MediaWiki/Wikimedia● Wiki structure● Magic words, access levels● User JS/CSS – Gadgets● “Uselang” hack
Outline
Opensource (GPL) wiki engine software (uses LAMP)
MediaWiki
Wikimedia
MediaWiki
Name of a social movement; also US charity (Wikimedia Foundation)
● Subpages
Wiki structure
By default only in talk, user pages
Subpages
Help:Subpages
● Subpages● Links
Wiki structure
Special:MostLinkedSpecial:WhatLinksHereSpecial:RecentChangesLinkedSpecial:WantedPages
Links
Help:Links
● Subpages● Links● Categories
Wiki structure
Categories
Help:Categories
Nine special pages for categories
● Subpages● Links● Categories● Templates
Wiki structure
Page transclusion: {{foo}}<noinclude>, <includeonly>, {{subst:foo}}Parameters
Templates
Help:Templates
Special:ExpandTemplates
Special:ExpandTemplates
● Subpages● Links● Categories● Templates● Namespaces
Wiki structure
“Front” page + talk page● Main, Project, Help● Template● Category● Special*● Image, Media*● MediaWiki(* = psuedo namespace)
Namespaces
Help:Namespaces
Special:RecentChangesSpecial:SpecialPages
Special pages
Help:Special pages
Special:UploadImage 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
Images (uploaded files)
“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
MediaWiki:sidebar
MediaWiki:welcomecreationMediaWiki:copyrightwarning, 2MediaWiki:searchresulttextMediaWiki:uploadtext
Interesting pages
About the sidebar...
Manual:Interface/Sidebar
About the sidebar...Move search box
to top for usability
About the sidebar...MediaWiki:Mainpage
Main Page
Move search box to top for usability
About the sidebar...MediaWiki:Mainpage
Main Page
Move search box to top for usability
Delete defaults,Add yourown links
MediaWiki:Common.cssMediaWiki:Common.js
Monobook skin: (same for others)MediaWiki:Monobook.cssMediaWiki:Monobook.js
Look & feel
Modify an existing one:
User:Foo/monobook.css,js
Myskin – empty to start with
Skins – roll your own
Youruser page
Name of skin.Must start with
lowercase
“Behaviour switches”:
__NOTOC__,__TOC__#REDIRECT [[Foo]]__HIDDENCAT__ (on category pages)
Magic words
Help:Magic words
__HIDDENCAT__
Help:Magic words
Look like {{CAPS TEMPLATES}}Especially used in templates context.● Time, revision related● Stats!{{NUMBEROFARTICLES}}{{NUMBEROFEDITS}}{{NUMBEROFUSERS}}{{PAGESINCATEGORY:Foo}}
Variables
Help:Magic words
Special:ListGroupRights
● “Anonymous”/IP editor● (registered) User● > Autoconfirmed!● Sysop (==”admin”)● Bureaucrat● Bot
User access levels
Manual:User rights
Time $wgAutoConfirmAgeEdit count $wgAutoConfirmCount
After passing both, User automaticallygraduates to Autoconfirmed
(On Wikipedia thought to be ~ 4 days)
Autoconfirmed?
Semi/protection
Manual:Administrators
Semi/protection
Manual:Administrators
AND non-
autoconfirmedusers!
Massively simplify user JS/CSS sharing:no more copying user subpages
MediaWiki:Gadgetsdefinition> New Preferences tab
JS/CSS Gadgets
Extension:Gadgets
MediaWiki:GadgetsdefinitionMediaWiki:Gadget-section-browsing-gadgets
MediaWiki:Gadget-Navigation popups
List of file namesMediaWiki:Gadget-foo.js/css
Special:Preferences > Gadgets
Gadget rec: HotCatInstead of this:[[Category:Melbourne Cricket Ground]]
Try this:
http://commons.wikimedia.org/wiki/MediaWiki:GadgetHotCat.js
Make your edit box less scary:Gadget rec: wikEd
http://enwp.org/WP:WIKED
(This is not really recommended...)
Use it to make different versions of special pages, eg upload form
Uselang parameter overrides user language prefsSpecial:Upload?uselang=fr – I can see the French version of the form without changing my prefs
“Uselang” hack
http://commons.wikimedia.org/wiki/Commons:Redesigning_the_upload_form
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)
“Uselang” hack
http://commons.wikimedia.org/wiki/Commons:Redesigning_the_upload_form
● http://mediawiki.org is halfdecent 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?
Brianna [email protected]
These slides are duallicensed GFDL1.2+, CCBYSA3.0. Screenshots are GFDL/GPL, WMF logo is all rights reserved, MediaWiki logo is public domain.
Thankyou!
http://brianna.modernthings.org/