Find and replace text in an entire wiki

From Organic Design
Jump to: navigation, search
Procedure.svg Find and replace text in an entire wiki
Organic Design procedure

Installing the script

Currently we have no in-wiki means of performing this task, so we use a dedicated Perl script called Caretaker.pl. The script should be run from the server hosting the wiki, and you should find it located in /var/www. If it's not there, you can create the file from the code in the wiki at caretaker.pl and you will also need to ensure that wiki.pl is in the same directory as the caretaker script.

Configuration

Before running the script you must edit it and set the configuration variables for the wiki URL (use long form) and the wiki user and password to do the editing as. The script uses a direct database connection to obtain the list of articles to process, so you also need to fill in the database name, table prefix and a database user and password (default is to use the same credentials as the wiki login).

Replacement rules

The replacement regular expressions must also be edited in the script in the clearly marked section near the middle.

Test and run

The script speed can be adjusted (by setting the value in the sleep call near the end) so that you can stop it after one or two changes and then check in the wiki whether it's doing the right thing and revert it if not. Once it's working fine, put the speed up to 0.1 or 0.2 and do the main run.