About this wiki

From Bjoern Hassler's website
Jump to: navigation, search

This page is to record how this wiki was put together, in case you want to replicate this.

1 Basic setup[edit]

1.1 download and installation[edit]

Mediawiki 1.12.0, downloaded and installed from the download link of the mediawiki page.

tar zcvf mediawiki-1.12.0.tar.gz
mv mediawiki-1.12.0 wiki_source

The follow installation procedures.

I copied a php.ini file into the root, setting

register_globals = Off 

because by default this was turned on.

1.2 Only let people post after registration[edit]

If people can post without registration, you end up with spam, so at least we need to add this to LocalSettings.php

$wgEmailConfirmToEdit = true;

It probably won't protect us from spam in the long run, but at least it's a step.

1.3 Pretty urls with .htaccess[edit]

1.3.1 Pretty urls with .htaccess (Recommended methods)[edit]

The first method we used (see below) broke the collections extension. The recommended method is this

but we don't have root access, so we used

NOTE: As this is a path-to-query rewrite rule, plus signs in titles will not work correctly.

1. Edit or create .htaccess in your document root directory (typically, public_html) with the following content.
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^wiki/(.*)$ wiki_source/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ wiki/ [L,QSA]
RewriteRule ^/*$ wiki/ [L,QSA]

'RewriteCond' makes sure that existing files and directories are not rewritten, which would only apply if "wiki" was an actual directory, which it should not be (your wiki should be installed in a directory called "wiki_source", not "wiki"!). So the RewriteCond lines are, strictly speaking, not needed.

'RewriteRule' defines the rewrite; in the example above, '^wiki/(.*)' will invisibly load 'wiki_source/index.php?title=$1', where the page name after 'wiki/' will replace '$1'.

Also note that this does not work unless Options FollowSymLinks is enabled.

2. Add or edit the following setting in LocalSettings.php. This causes the HTML generated by MediaWiki to refer to "/wiki/Articlename" instead of the default.
$wgScriptPath = "/wiki_source";         # Path to the actual files (right part of first rewrite rule). Should already be there
$wgArticlePath = "/wiki/$1";  # Virtual path (left part of first rewrite rule). MUST be DIFFERENT from the path above!

Note: If your .htaccess seems to have no effect whatsoever, you need to make sure that your Apache configuration (httpd.conf and its includes) does not have "AllowOverride None" specified for the server root (/). Your system administrator will need to fix this problem.

1.3.2 Pretty urls (this method is not recommended!)[edit]

THIS METHOD DOES NOT WORK WITH THE COLLECTIONS EXTENSION!

Create this .htaccee file in wiki directory.

RewriteEngine On

# Don't rewrite requests for files in MediaWiki subdirectories, 
# MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images|skins)/
RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/wiki/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/wiki/favicon.ico
RewriteCond %{REQUEST_URI} !^/wiki/robots.txt

# Rewrite http://wiki.domain.tld/article properly, this is the main rule
RewriteRule ^(.*)$ /wiki/index.php?title=$1 [L,QSA]

Add this to LocalSettings.php

# short urls
$wgArticlePath      = "/wiki/$1";
$wgUsePathInfo = false;

You now get prtty links of the form http://www.ict4e.net/wiki/Main_Page


1.4 Google Analytics[edit]

See http://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration

In the wiki_source/extensions directory, run

svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/googleAnalytics/

which gives you googleAnalytics.php and googleAnalytics.i18n.php in that folder

Add the following code to LocalSettings.php at the bottom

require_once( "$IP/extensions/googleAnalytics/googleAnalytics.php" );
$wgGoogleAnalyticsAccount = "UA-xxxxxxx-x";
$wgGoogleAnalyticsIgnoreSysops = false;
$wgGoogleAnalyticsIgnoreBots = false;

1.5 New user log[edit]

Source:

http://www.mediawiki.org/wiki/Extension:Newuserlog

Download extension files from Wikimedia SVN to extensions/Newuserlog directory.

svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Newuserlog

Add the following line to your LocalSettings.php file:

require_once("$IP/extensions/Newuserlog/Newuserlog.php");

Account creations are now recorded in Special:Log/newusers

1.6 Collection[edit]

http://www.mediawiki.org/wiki/Extension:Collection

In wiki_source/extensions, run

svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/Collection

In LocalSettings.php, add

require_once("$IP/extensions/Collection/Collection.php");

Finally modify wiki_source/skins/MonoBook.php: see README.txt <!-- EXTENSION - Collection --> <?php if(isset($GLOBALS['wgSpecialPages']['Collection'])) { Collection::printPortlet(); } ?> As the current collection of articles is stored in the session, the session timeout should be set to some sensible value (at least a few hours, maybe one day). Adjust session.cookie_lifetime and session.gc_maxlifetime in your ``php.ini`` accordingly.

Read the README.txt file for full details the installation and Help:Collections for help with using collections.

Initially the install didn't quite work: This seemed to be to do with the pretty url scheme, see above. While the 'my collection' portlet appears (under search on the left), it's not possible to name/save/print collections.

Comments:

  • It would be nice if you could generate the pdf straight from the collection page, i.e. to pick a collection from here Collections category, and to have a print button straight on this page: User:Administrator/Collections/Mediawiki-HowTo. At the moment, you have to load the collection before being able to print it.
  • It would be nice if navigation was added to pages that are in a collection. I.e. after loading a collection, and additional navigation bar appears on a page that's part of the collection, that has (previous) (up) (next) and (toc). Then you would really be able to use collections as books.

1.7 Multi-Language manager[edit]

Description is here

http://www.art122-5.net/index.php/MediaWiki_multi-Language_management_with_the_extension_MultiLanguageManager

Download from here

http://www.art122-5.net/index.php/Download_MultiLanguageManager_1.0.1.tgz

Once you have the MultiLanguageManager_1.0.1.tgz file (60K), place it into the wiki_source/extensions directory and unpack it. You get a 'MultiLanguageManager/' directory, with some files in it.

In wiki_source, you run

mv -i  extensions/MultiLanguageManager/tools/MultiLanguageManager_createTable.php .

and then browse to

http://www.ict4e.net/wiki_source/MultiLanguageManager_createTable.php?

After which you remove the MultiLanguageManager_createTable.php

Then edit MonoBook.php, to include <!-- EXTENSION - Multilanguage --> <?php $languageController=new MultiLanguageManager_controller(); $myTitle=Title::newFromId($this->data['articleid']); echo $languageController->displaySelectLanguage($myTitle); ?>

To do:

  • the mutlilanguage manager doesn't support many languages. We need to add spanish.

The pages are 'loosly' coupled, see Multilanguage Test. Another approach is this: http://www.art122-5.net/index.php/MediaWiki_Multi-language

1.8 Experimental: Simple Pie[edit]

http://simplepie.org/wiki/plugins/mediawiki/simplepie_plugin_for_mediawiki

include("./extensions/simplepie_mediawiki.php");

We are using this with mediawiki 1.12 and simple pie 1.1.1, and it seems to working fine. Examples and tests, see Mediawiki SimplePie usage and Mediawiki SimplePie example.

1.9 Email notification when a new user registers[edit]

http://www.mediawiki.org/wiki/Extension:New_User_Email_Notification

2 Additional extensions[edit]

The following extensions are not yet installed, but Administrator is planning to install them. Notes on how to do this will appear above.

The following extensions are not yet installed, and Administrator is not planning to install them.

Quite a few useful extensions are mentioned here

3 wiki size[edit]

Pages are about ~ 130KB, which is very big. If somebody has optimised versions of the js/css let me know! We'll change the images to something small, whcih will cut 40KB. Primed cache is less than 10KB, so for those visiting regularly it's probably not an issue. (Similar comments apply for drupal site!)

You can browse the site through loband, which gets rid of some of the size:

And you can also use our very own wiki mirror tool:

4 Additional items[edit]

Move to Mediawiki.