Wednesday 28 July 2010

Protection, Protection, Protection!



A long long time ago when I can still remember (well I think it was about 3 years ago), I set up a MediaWiki on my website (installation instructions are here). Whilst I was reaping the benefits of having a nice Web 2.0 interactive site, with ease of adding new content and web pages, something more sinister was lurking in the background. It was spam. Because there were few extensions at this time to prevent spam I thought it wouldn't happen to me. I was later told by my server administrator that I had a few gigs of spam on my wiki that was slowing down the whole server.

After removing the last wiki, I have now bravely decided to install it again (fortune favours the bold). This time round however, the first thing I have done is install all the possible extensions to combat spam. There is an exhaustive list of extensions here. There are a number of ways that one can restrict spam:

1. Restrict reading of the wiki, by setting $wgGroupPermissions['*']['read'] = false;
2. Prevent account creation, except by the administrator $wgGroupPermissions['*']['createaccount'] = false;
3. Restrict anonymous editing by setting $wgGroupPermissions['*']['edit'] = false;
4. Admin can also use the 'protect' facility to restrict access to certain pages.
5. Removing the login link / create account link using the following function:

function NoLoginLinkOnMainPage( &$personal_urls ){
unset( $personal_urls['login'] );
unset( $personal_urls['anonlogin'] );
return true;
}
$wgHooks['PersonalUrls'][]='NoLoginLinkOnMainPage';

6. Capatcha extension
The fact that edits have to be confirmed means that most bots will not be able to make edits to the wiki. This extension is simple to install, simply download the php file and add require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" ); to your localSettings.php file, like all other additions shown above.


Now that my wiki is much more secure I thought I would also add a few more extensions. Clearly it is useful to have your calendar displayed without going to say your gmail all the time. MediaWiki has an extension for this here. Just download the extension then go to this link to get details on your calendar and copy and paste all information between "googlecalendar" tags, ignoring all comments before the '?' and removing the "iframe" tag at the end.


I have also installed the chemistry extension, which works, but in my opinion is in rather a beta stage of development. It allows you to write chemical formulas into your wiki between "chemform" tags and it automatically corrects the sub and superscripting of atom numbers and charges. See here for examples. One of the problems however that I have found with this extension, is that say for example you have dioxygen with a single negative charge, and put 02- it actually displays the molecule as though it has one oxygen atom with a -2 charge. Clearly some work will be needed on this extension, but it's interesting to see freely available chemistry extensions coming out of the wood work for MediaWiki.

No comments:

Post a Comment