Mediawiki: Difference between revisions
(→Software hacks, 1.5.2: Make explicit that mod_ucam_webauth is needed) |
m (Make link work.) |
||
Line 4: | Line 4: | ||
==Software hacks, 1.5.2== | ==Software hacks, 1.5.2== | ||
These hacks all assume that the Mediawiki application is first protected by something that sets the REMOTE_USER apache server variable, such as the [ | These hacks all assume that the Mediawiki application is first protected by something that sets the REMOTE_USER apache server variable, such as the [http://raven.cam.ac.uk/project/apache/ Raven Apache authentication module]. | ||
===<tt>User.php</tt>=== | ===<tt>User.php</tt>=== |
Revision as of 09:26, 20 December 2005
Mediawiki is the wiki software powering wikipedia. It can fairly easily be made to work with Raven. The Computing Service has been using a Raven-enabled copy of Mediawiki internally for some time. CARET have a Raven-enabled copy of Mediawiki that is available to the university - see http://wiki.caret.cam.ac.uk/
Software hacks, 1.5.2
These hacks all assume that the Mediawiki application is first protected by something that sets the REMOTE_USER apache server variable, such as the Raven Apache authentication module.
User.php
Line 60, newFromName, replace:
$t = Title::newFromText( $name );
with:
$t = Title::newFromText( $name , NS_USER );
To explicitly specify the namespace. This will be used to check in the hack in Title.php, below.
Line 153, idFromName:
$s = $dbr->selectRow( 'user', array( 'user_id' ), array( 'user_name' => $name ), $fname );
... and in the function loadFromSession():
if ( isset( $_SERVER["REMOTE_USER"] ) ) { $sName = $_SERVER["REMOTE_USER"]; $sId = User::idFromName($sName); $user = new User(); if ( $sId == 0 ) { /* User doesn't exist here yet. */ $user->setName($sName); $user->addToDatabase(); } else { $user->mId = $sId; $user->loadFromDatabase(); } return $user; }
Title.php
Stop the first letter of userpages being capitalised, so we can stick with CRSIDs being all lowercase everywhere. To do this, in the (private) function function secureAndSplit(), replace:
if( $wgCapitalLinks && $this->mInterwiki == '' ) { $t = $wgContLang->ucfirst( $r ); } else { $t = $r; }
With:
if( $wgCapitalLinks && $this->mInterwiki == '' && NS_USER != $this->mNamespace ) { $t = $wgContLang->ucfirst( $r ); } else { $t = $r; }