Difference between revisions of "MediaWiki Admin"

(Development workflow)
Line 95: Line 95:
== Development workflow ==
== Development workflow ==
# Get any new changes from the central repository: <pre>git checkout master ; git pull origin master</pre>
# Get any new changes from the central repository: <pre>git checkout master ; git pull origin master</pre>
# Check out your DevConfig branch: <pre>git checkout DevConfig</pre>
# Replay your DevConfig on top of the master branch: <pre>git rebase master</pre>
# Make changes, test that they work.
# Stash your changes: <pre>git stash</pre>
# Check out your master branch: <pre>git checkout master</pre>
# Apply the changes: <pre>git stash pop</pre>
# Commit the changes: <pre>git commit -a -m "Did something...."</pre>
# Commit the changes: <pre>git commit -a -m "Did something...."</pre>

Revision as of 11:02, 3 June 2011

Creating New Wikis

  1. SSH to the mediawiki server
  2. cd to the mediawiki directory
  3. Run the createWiki command to create a new wiki.
  4. Optional: Edit the wiki's LocalSettings file to add additional extensions or limit access.

The createWiki command

Running the createWiki command with no argument (or -h for help) will display the following usage message:

$ createWiki -h

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
1048    Jason Mittell

The createWiki command will create the new wiki directory in webroot/wikis/, create a default config, add an images directory, and install all the needed database tables.

By default the following extensions are enabled:

  • Cite
  • EmbedVideo
  • FCKeditor

Adding Extra Extensions

Most extensions should be included from the shared extension directory rather than from a per-wiki extension directory. Use the shared-directory constant for the path, e.g.:

require_once( MIDD_MEDIAWIKI_SHARED_DIR."/extensions/FCKeditor/FCKeditor.php" );

Restricting Access

Wikis can be restricted by setting the default read and edit permissions to false and then adding a list of groups and/or a list of authorized users who can view or edit to the LocalSettings.php for a wiki.


# 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");

# CAS Authentication
// Full Group Id
$wgCASAuthorizedGroups = array(
"CN=LIS Librarians,OU=General,OU=Groups,DC=middlebury,DC=edu",
"CN=LIS Liasons,OU=General,OU=Groups,DC=middlebury,DC=edu",

// Users' web-id
$wgCASAuthorizedUsers = array(

Testing/Developing for MediaWiki

Initial Setup

Cloning the central repository

Your ssh keys must be authorized to access the central repository. All chisel accounts' ssh keys have been authorized to do so at the time of this writing. Contact Adam to add ssh keys for other machines (such as your desktop) if desired.

  1. cd to your home directory on chisel:
    cd ~
  2. clone the repository and create a working directory with git-clone:
    git clone git@chisel.middlebury.edu:mediawiki.git
    You should now have a working directory at ~/mediawiki/
  3. cd to your public_html directory on chisel:
    cd ~/public_html/
  4. Make a symbolic link to the mediawiki webroot:
    ln -s ../mediawiki/webroot mediawiki


Config settings can be overridden via a MiddSettings.php file in the root of the working directory. This file is not tracked by Git to avoid pushing dev settings to production.

cd ~/mediawiki/
cp MiddSettings.php.sample MiddSettings.php

Then edit your MiddSettings.php to reflect your paths (probably just replacing 'myusername' with your username.

Testing the Site

Your copy of the LIS wiki will be available at:


Development workflow

  1. Get any new changes from the central repository:
    git checkout master ; git pull origin master
  2. Commit the changes:
    git commit -a -m "Did something...."

Upgrading MediaWiki core

  1. cd to the webroot:
    cd mediawiki/webroot/
  2. Checkout the core branch:
    git checkout core
  3. Download the new version of mediawiki:
    wget http://download.wikimedia.org/mediawiki/1.16/mediawiki-1.16.5.tar.gz
  4. Decompress the new version then delete the download
    tar xzf mediawiki-1.16.5.tar.gz ; rm mediawiki-1.16.5.tar.gz
  5. Delete the old version and move the new version into place
    rm -Rf mediawiki/ ; mv mediawiki-1.16.5 mediawiki
  6. Stage the changes
    git add mediawiki ; git add -u mediawiki
  7. Commit the changes
    git commit -m "Upgraded to mediawiki-1.16.5 from download"
  8. Merge the new version into our configuration
    git checkout master ; git merge core

After updating, the mediawiki update script needs to be run. Adam wrote a wrapper script that executes it for every wiki:

php midd_maintenance/midd_update_all.php