Saturday 17 July 2010

Rich Text Editors For MediaWiki Wikis

When users with a lesser degree of technical knowledge and understanding of markup languages get involved with Wikis and MediaWiki Wikis in particular they quite often get put off from actually doing any editing because of their unfamiliarity with the Wikitext markup language.

Although the Wikitext language was developed with the intention of being a lightweight markup language for its simplicity and ease of use when editing Wiki pages, it's still a markup language and as such takes time to learn.

As a result of this, large Wiki farms and in particular Wikia have incorporated Rich Text editors into their Wikis so that newer users can edit in an environment that they feel comfortable in.

I'm currently working on finding/developing a rich text editor suitable for my own Wiki. Below is a list of MediaWiki-compatible rich text editor extensions I've found so far.
  • CKeditor - Previously known as FCKeditor, a modified version of this editor is currently being tested on most Wikia Wikis.
  • Extension:FCKeditor (by Mafs) - An experimental rich text editor based off of an older version of CKeditor
  • widgEditor A free, open source WYSIWYG (What You See Is What You Get) editor designed to be used for relatively simple editing in rich text.

I'll update this list as and when I find new ones. If anyone knows of any more please do leave a link to them in the comments section and I'll add them to the list. :)

Friday 16 July 2010

How To: Export/Backup Pages Using XML Dumps

If you run a small Wiki with not much to backup then this may be the option for you. If you run a Wiki quite a few pages on it on the other hand you may be interested in a 2 part post I made on fully backing up MediaWiki Wiki found here.

If you visit the Special page Special:Export on your Wiki you should find an interface similar to the one shown below.

This interface can be used to export small numbers of pages from your Wiki in XML format so that they can be uploaded again on another MediaWiki Wiki through the Special page Special:Import. The whole contents of a particular category can be exported by adding the category name (excluding the "Category" prefix) to the single line textbox at the top of the interface.

If you are looking to backup pages through the Special:Export I strongly recommend *un*checking the export setting "Include only the current revision, not the full history" as you will want the page histories saved for attribution purposes among others.

When ready, click the "Export" button and the pages specified will be made available to download in XML format, ready to be uploaded to another Wiki or stored as a backup.

Note: Special:Export should only really be used to backup a small number of pages as it was not intended to be uised to export large numbers of pages. Exporting large numbers of pages may result in connection failures and timeout errors among other problems due to technical limitations.

Thursday 15 July 2010

How To: Backup Your Wiki - Backing Up The Wiki (Part 2 of 2)

If you haven't already done so please read Part of How to Backup Your Wiki for an insight on what actually requires backing up and the prerequisites before proceeding. ;)

Getting Started


Access your web hosting account through FTP using FileZilla or a similar client. If using FileZilla, the download destination for files you backup will default to the folder currently being viewed in the main window to the left, the right window contains the files and folders currently being stored by your web host. Choose your preferred location to store your Wiki's backup files and create a directory there by right-clicking an empty space in the left window and clicking "Create directory" naming the folder "Wiki Backup" or something similar.

Finding the Files and Folders

In the window above the main right window, find the folder called "public_html" and double-click it. You should now see the folder folder you chose to install your Wiki in when first setting up the MediaWiki software package, the name of the folder is typically something like "wiki" or "w", double-click this folder, this is known as the "root" folder. Both the LocalSettings.php and AdminSettings.php files are stored in the root folder so find them and download them by right-clicking each file and clicking "Download". Your LocalSettings and AdminSettings files are now backed up.

Next, find your Wiki's "images" folder, this also will be in your Wiki's "root" folder and should be somewhere near the top. Right-click the folder and click "Download" (This may take some time to download depending on how many images have been uploaded to your Wiki). After all files have transferred successfully your images have been backed up.
If you have any extensions installed you will also need to download a copy of the "extensions" folder located in your Wiki's root folder.

Backing up a Custom Skin

If you're currently using a custom skin on your Wiki, this will also need to be backed up. The skin's files will be located in the "skins" folder. The "skins" folder contains a bunch of main skin files and folders named after the respective skins, you will need to download a copy of your skin's main file (It will be called something like "MyCustomSkinName.php") and its corresponding folder, again, named after the skin.

Backing up your Wiki's pages, users, their preferences, logs and everything else...

... Isn't as painful and complicated as it sounds believe it or not. You will need to access your Wiki's database though (D'oh!). Tell you what though, for all of you out there who (like me) have a very limited knowledge of using databases I'll make this as simple as I possibly can for you and I'll even upload some screenshots, how about that? :)

Ok, first of all you'll need to log in to your Wiki's database with the username and password supplied to you by your web host, if you don't know where to log in, your username or password please contact your web host and they should be able to give you the details you need.
Once logged in there the name of your database on the left-hand side of the screen, click the name of your database and then look for an "Export" tab (this should look something like the way it does in the screenshot supplied below).


You should now have roughly 3 or so export settings sections. "Export", "Options" and "Save as file". Typically you want the default settings in each of these sections. There are a few things to check however, make sure that all of the contents of the box below is selected.

You will also want to make sure that out of the options available underneath this box, you have the export as "SQL" option selected. And finally you can go straight ahead and click "Go" to download your Wiki's database. Once successfully downloaded your entire database will be backed up, so that means you will now have backed up: Your Wiki's pages, its page histories, logs, users and user preferences. A word of warning however, do not under any circumstances manually edit your SQL backup, as you will muck it up.

Congratulations, you've now completely backed up your Wiki!

How To: Backup Your Wiki - Things to Consider (Part 1 of 2)

When I was learning basic Computer skills in school, I was taught a very simple thing to be applied to almost everything you do on a Computer. "SOS" which apparently stood for "Save Often, Stupid" according to my I.T teacher at the time, he does have a point though, backing up anything and everything that you don't want to or even can't risk losing is an absolute must.



In the case of Wikis, making a good backup of your website on a regular basis should be one of your highest priorities as things can easily go pear-shaped and you could end up losing hours, days, weeks or even months worth of yours and other people's work.

With MediaWiki Wikis there are various methods of backing up but I'm just going to share with you the two simplest and most efficient methods.



Items that require backing up


Before you do jump straight in and copy every single file and folder in your Wiki's web hosting account however, you have to consider the files and folders that actually do need backing up, there's no point in backing up the default Special Pages for example as should something go critically wrong, you'll probably need to re-install your MediaWiki software package and such files would be created by the MediaWiki software during the installation. The files and folders you do need to backup are:
  • The LocalSettings.php and AdminSettings.php files.
  • The /images folder.
  • The current skin in use on your Wiki (Only if you're currently using a skin other than one of the default skins)
  • If you have any extensions installed you will need to backup the /extension folder.
  • All pages and page histories, user preferences and logs.

On to part 2 of the guide to backing up your Wiki

Wednesday 14 July 2010

How To: Install The HotCat Gadget On Your Wiki

The HotCat gadget was originally developed for use on Wikimedia Commons but soon gained popularity on other Wikimedia Wikis including the English Wikipedia, this is where I first heard about this neat little gadget and have since enabled it for use on my own personal account on Wikipedia and installed a customized version of the script on my Wiki.

If you aren't already aware of what HotCat is or what it does, it's basically a tool designed to make adding categories to Wiki pages easier and quicker written in JavaScript (Originally by
User:Magnus Manske).





There are 2(?) versions of HotCat currently available, the version currently used on Wikimedia Commons (Be warned, this page contains a lot of code) and the version I use on my Wiki, the version currently in use on the English Wikipedia.


Whichever version of HotCat you decide to install on your own Wiki, the installation method remains the same and just as dead-simple. Either click here and download the full script in .txt format or copy all the code directly from this page and paste it to the MediaWiki page: MediaWiki:Common.js, this will install HotCat for all users of your Wiki. Done!

Tuesday 13 July 2010

How To: Monetize Your Wiki with Google's AdSense

A popular method of monetizing Wikis, and websites in general, is by adding Google's AdSense advertising units, which opens up the very common question: How do I add AdSense units to my Wiki? As far as I'm aware there is no *official* Google extension to allow the displaying of AdSense units (If you know of one please do leave a link in the comments to this post!) but there are several extensions available that do the job:

To download Extension:Google Adsense 2 click here and download the compatible package for your MediaWiki version from the drop-down box. Once you've downloaded the package, unzip it and upload it to your Wiki's /extensions folder. Once uploaded copy the following code to the bottom of your LocalSettings.php file:

require_once( "$IP/extensions/GoogleAdSense/GoogleAdSense.php" );
$wgGoogleAdSenseClient = 'replace this with the client name';
$wgGoogleAdSenseSlot = 'replace this with the slot name';
$wgGoogleAdSenseID = 'replace this with your ID';

If installed correctly, the extension should appear on the Special:Version page on your Wiki.

Monday 12 July 2010

Customizing MediaWiki: Random questions answered

What exactly is the LocalSettings.php file?

The LocalSettings.php file is the main configuration file for MediaWiki Wikis and is created during installation of the MediaWiki software.

How do I edit the LocalSettings file?

To edit the LocalSettings.php file you'll need a good PHP editor, however, do NOT edit this file with any text editor that adds byte order marks to files as you'll be more likely to break your Wiki before you customize it, in simple English (As this is what this Blog's all about after all... Don't edit the file with Notepad!) I personally use
jEdit, it's free, versatile and gets the job done, however, there is also a list of PHP editors on Wikipedia.

How do I find and install extensions to the MediaWiki software?

Extensions can be found here by category on MediaWiki.org. A typical extension installation usually involves downloading the extension package and adding it to your /extensions folder followed by adding this code to your LocalSetting.php file:

require_once( "$IP/extensions/folder_name/extension_name.php" );


Generally speaking, most popular extensions are fairly well documented and have pretty specific installation instructions if the extension cannot be installed using the typical method mentioned above. Once installed correctly the extension will display under the "Installed extensions" section of the Special:Version page on your wiki.

How do you prevent an anonymous user's IP address from showing up next to the Log in / create account link?

This can be disabled by adding this code to your LocalSettings.php file:

$wgShowIPinHeader = false;

How do you prevent the view counter from showing up on pages?

You can completely remove the counters by adding:

$wgDisableCounters = true;

To your LocalSettings file.