Jump to content

MediaWiki Introduction 2023

From mediawiki.org
Revision as of 23:04, 4 July 2024 by Krinkle (talk | contribs)

MediaWiki Introduction 2023 is a 3-part video series by Timo Tijhof, recorded in December 2023 for the MediaWiki Code Jam.

Part 1: MediaWiki core concepts

Watch on Wikimedia Commons.Watch on YouTube

Timestamps:

00:00 Outline
00:50 Database schema
01:37 Users
02:55 Preferences
04:12 Localisation
05:02 Permissions
08:50 Bot passwords
10:10 Logging
11:58 Comments
12:35 Recent changes
15:39 Pages
16:00 Namespaces
18:14 Revisions
18:20 Example: Save an edit
19:59 Example: View a page
20:52 Link tables
21:02 Categories
24:20 Templates
25:05 Image links
25:59 GLAM
26:43 External links
27:40 Statistics
28:02 Search
29:14 JobQueue
31:58 Multimedia

High-level product and architecture perspective. Component walk-through.

Part 2: Wikipedia's extensions

Watch on Wikimedia Commons.Watch on YouTube

Timestamps:

00:00 Outline
00:25 What is an extension?
01:52 How to install an extension?
02:01 Install WikiEditor
02:54 Install VisualEditor
03:58 Wikipedia's extensions
04:10 CentralAuth
04:38 Echo
04:56 OAuth for MediaWiki
05:40 Editor extensions
05:48 Parser extensions
06:37 Cite extension
07:37 EasyTimeline
07:56 InputBox extension
08:38 Scribunto
09:38 Faster editing performance
11:24 Media handlers
11:31 TimedMediaHandler
11:42 3D extension for MediaWiki
11:57 Spam prevention extensions
12:35 Gadgets
13:05 Gadget demo
13:41 Gadget examples

What is an extension?

How to install an extension in two easy steps.

Walk-through the installed extensions via Wikipedia's Special:Version page.

Part 3: Write an example patch

  • Homework preparation:
    • Quickstart.
    • Run PHPUnit, e.g. composer phpunit -- tests/phpunit/includes/ResourceLoader/
    • Run QUnit, e.g. view http://localhost:4000/index.php/Special:JavaScriptTest
    • Clone the "examples" repo in your extensions/ directory, and enable it.
  • How does an extension actually work?
  • How do special pages work?
  • Localisation
    • uselang=qqx (debugging, contributions, Translatewiki.net)
    • Help:System message
    • i18n/en.json (git-grep, "MessageDirs")
  • Excercise 1: Edit a localisation message. Change the "example-helloworld" message and notice the change on Special:HelloWorld.
  • Excercise 2: Create a new localisation message, and output it on Special:HelloWorld.
  • Hooks
    • extension.json ("Hooks" is a registry, "HookHandlers" is a registry)
    • MediaWiki will call Hooks.php#onSomething, now it's our turn.
    • Manual:Hooks
    • BeforePageDisplay
    • $wgExampleEnableWelcome (extension.json, "config" is another registry)
    • Namespaces (remember from Part 1)
  • Excercise 3: Make a config change. Edit LocalSettings.php to disable $wgExampleEnableWelcome and notice the change on Main_Page. Comment your edit to re-enable it.
  • Excercise 4: Edit a hook handler. Make it welcome you on special pages instead of articles. Notice the change on Special:HelloWorld and Main Page.
  • ResourceLoader
    • extension.json ("ResourceModules" is another registry, "dependencies", "packageFiles")
    • ResourceLoader/Developing with ResourceLoader
    • onBeforePageDisplay, OutputPage::addModule.
    • welcome.js
    • styles.css
    • Special:JavaScriptTest?filter=welcome
    • ext.Example.welcome.test.js
  • Excercise 5: Fix a bug and test it with QUnit. The welcome message greets you with the wrong day.
  • Save your change and upload it to Gerrit:
    • git add -p
    • git commit
    • git-review.
    • Gerrit.
    • WMF CI: Jenkins build output.