MediaWiki Admin
Creating New Wikis
- SSH to the mediawiki server
- cd to the mediawiki directory
- Run the
createWiki
command to create a new wiki. - 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.
Example:
# 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( 'A0F836FCD9DFDD8F7A27D02C62CDB225', );
Testing/Developing for MediaWiki
Initial Setup
Cloning the central repository
Your ssh keys must be authorized to access the central repository. All anvil 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.
- cd to your home directory on anvil:
cd ~
- clone the repository and create a working directory with git-clone:
git clone git@git.middlebury.edu:mediawiki.git
You should now have a working directory at ~/mediawiki/ - cd to your public_html directory on anvil:
cd ~/public_html/
- Make a symbolic link to the mediawiki webroot:
ln -s ../mediawiki/webroot mediawiki
Grabbing the submodules
The MediaWiki project includes several submodules, MiddMedia and phpCAS, that are not available in the project after you clone it from the central repository. To fetch these scripts, perform the following commands.
- cd to the mediawiki project directory on anvil:
cd ~/mediawiki/
git submodule init
git submodule update
Configuration
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:
http://anvil.middlebury.edu/~yourname/mediawiki/mediawiki/index.php/LIS/Main_Page
Development workflow
- Get any new changes from the central repository:
git checkout master ; git pull origin master
- Commit the changes:
git commit -a -m "Did something...."
Upgrading MediaWiki core
- cd to the webroot:
cd mediawiki/webroot/
- Checkout the
core
branch:git checkout core
- Download the new version of mediawiki:
wget http://download.wikimedia.org/mediawiki/1.16/mediawiki-1.16.5.tar.gz
- Decompress the new version then delete the download
tar xzf mediawiki-1.16.5.tar.gz ; rm mediawiki-1.16.5.tar.gz
- Delete the old version and move the new version into place
rm -Rf mediawiki/ ; mv mediawiki-1.16.5 mediawiki
- Stage the changes
git add mediawiki ; git add -u mediawiki
- Commit the changes
git commit -m "Upgraded to mediawiki-1.16.5 from download"
- 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
- This page was last edited on 24 July 2015, at 13:46.
- Privacy policy
- About Library & ITS Wiki
- Disclaimers