Middlebury

MediaWiki Administration

Revision as of 13:58, 29 February 2012 by Adam Franco (talk | contribs)

Deployment

Installing MediaWiki on a new production host

1. (Option A) Copy the ssh public/private key pair from the old host to the new host:

scp /root/.ssh/id_* newhost:/root/.ssh/

1. (Option B) Create a new ssh key pair on the new host with ssh-keygen and add its public key to the gitosis configuration on chisel.

2. Clone the repository to /var/www/mediawiki/

cd /var/www/
git clone git@chisel.middlebury.edu:mediawiki.git
cd mediawiki
git submodule update --init

3. Add a post-merge hook so that all submodules will be updated when we run git pull in the future.

echo "#!/bin/bash
git submodule update --init --recursive" > .git/hooks/post-merge
chmod a+x .git/hooks/post-merge

3. Find all of the image directories on the old host with:

find mediawiki/webroot/wikis -type d -name images

Then take that list and search/replace each line into an rsync command:

rsync -av --delete oldhost:/path/to/mediawiki/webroot/wikis/CCP/images/ /newpath/to/mediawiki/webroot/wikis/CCP/images/

Then run all of the rsync commands. Note: Adding the new host's public key to the old host's ~/.ssh/authorized_keys2 file will allow you to run all of the rsync commands without entering your password many times.

4. Add the Apache virtual-host configuration to /etc/httpd/conf.d/vhost.conf. Restart Apache.

Updating MediaWiki in production

If the MediaWiki core code has been updated, then the database tables need to be updated.

1. Update the code:

cd /path/to/mediawiki
git pull

2. Run the MediaWiki update script on all wiki databases.

php midd_maintenance/midd_update_all.php

Creating new Wikis

In the MediaWiki root on the production host there is a createWiki script that will allow you to quickly create a new wiki:

Usage: createWiki -n <short name> -t <title> -a <admin id>

Example: createWiki -n TestWiki -t "A Wiki For Testing" -a 1003


Note: The admin user is the only one who will be able to go in and make
other users admins. This should likely be your id (internal to mediawiki).

The admin id is the 'user_id' field in the cas_users table in the mediawiki database.

Some ids you might wish to use:
1003    Adam Franco
1000    Joe Antonioli
1045    Ian McBride

You can then edit the wiki's LocalSettings.php file in mediawiki/webroot/wikis/TestWiki/LocalSettings.php to make any changes.

Common configuration additions

Restricting access to groups or users

All pages but the main page in a wiki can be restricted to certain groups or users by adding something like the following to the wiki's LocalSettings.php file.

# Disable reading by anonymous users
$wgGroupPermissions['*']['read'] = false;

# But allow them to read e.g., these pages:
$wgWhitelistRead =  array ( "Main Page", "Special:Userlogin", "Wikipedia:Help");

# Disable anonymous editing
$wgGroupPermissions['*']['edit'] = false;

# Authorized Groups
# Use the full DN of the group from the AD.
$wgCASAuthorizedGroups = array(
"CN=Helpdesk Staff,OU=General,OU=Groups,DC=middlebury,DC=edu",
);

# Authorized Users (in addition to those in the groups)
# Use the MiddleburyCollegeUID for the user.
$wgCASAuthorizedUsers = array(
'B0F836FCDADFDDFF7A17C02C62CDB227',       // Adam Franco
);

Changing allowed file types

##Override the default with a bundle of filetypes:
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ppt', 'pdf', 'doc');
$wgStrictFileExtensions = false;