Mediawiki: Difference between revisions
From RavenWiki
Jump to navigationJump to search
(...correctly) |
(A fix to keep userpages working, too. Don't capitalise usernames (CRSIDs) in the User: namespace.) |
||
Line 4: | Line 4: | ||
==Software hacks, 1.5.2== | ==Software hacks, 1.5.2== | ||
===<tt>User.php</tt>=== | |||
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 <tt>Title.php</tt>, below. | |||
Line 153, idFromName: | |||
<pre> | <pre> | ||
Line 10: | Line 18: | ||
</pre> | </pre> | ||
... and in the function | ... and in the function loadFromSession(): | ||
<pre> | <pre> | ||
Line 27: | Line 35: | ||
return $user; | return $user; | ||
} | } | ||
</pre> | |||
===<tt>Title.php</tt>=== | |||
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 <tt>function secureAndSplit()</tt>, replace: | |||
<pre> | |||
if( $wgCapitalLinks && $this->mInterwiki == '' ) { | |||
$t = $wgContLang->ucfirst( $r ); | |||
} else { | |||
$t = $r; | |||
} | |||
</pre> | |||
With: | |||
<pre> | |||
if( $wgCapitalLinks && $this->mInterwiki == '' && NS_USER != $this->mNamespace ) { | |||
$t = $wgContLang->ucfirst( $r ); | |||
} else { | |||
$t = $r; | |||
} | |||
</pre> | </pre> |
Revision as of 10:53, 6 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
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; }