TL;DR: How do I add a text (notice) to the content (not a header or global template) of every page?
(very) long question with background: I'm planning to migrate a MediaWiki over to another wiki. The content of the wiki has been migrated from an even older wiki before (where errors regarding formatting were generated), grown over time and is now outdated in large parts. That's why we want to start with a blank wiki and migrate the content manually, discarding and/or updating outdated pages.
To make this easier I want to add a textblock to the top of each existing page, specifically a template with a notice that this page hasn't been migrated or discarded yet and a category where all these pages are collected (e.g. category:migration_pending). Every user should then look through the pages he is responsible for, copy the content over to the new wiki and change the template to another one marking the page as migrated (category:migration_done) or discarded (category:migration_discarded). This way it should be possible to get a clean, up to date wiki without forgetting anything important.
The Replace_Text extension was unsuccessful, so I ended writing my own script that uses the MediaWiki API.
I started with the loginscript from here and wrote this script:
What the script basically does is:
Some additional notes:
domain
parameter has to be set. And it has to be set to the name of the LDAP source how it is configured inLocalSettings.php
, not the actual name of the domain.$wgEnableEmail = false;
and$wgEnotifWatchlist = false;
inLocalSettings.php
.Last, but not least, the template
migration_pending
I added to MediaWiki:This uses a CSS class for tables we had been using before and adds the page to a specific category. I added similar templates as
migration_done
andmigration_discarded
with the corresponding categories.