Setup of wiki

From Stephan

Jump to: navigation, search

When I set up a wiki site using MediaWiki to be used as a regular site for anonymous visitors, some things I change in the configuration for it. These steps I use for the installation and setup.

Contents

MediaWiki

Disable account-creation

Add this at the bottom of LocalSettings.php:

#                     Access / restrictions                ============================
#1 Show nothing in right-top when not signed in (except 'signin')
$wgShowIPinHeader=false;
#2 Disable creation of new accounts from anonymous connections: (Sysops can still create accounts)
$wgGroupPermissions['*']['createaccount'] = false; #Combine this with change of page-layout (login/create=>login)
#3 Disable editing from anonymous connections:
$wgGroupPermissions['*']['edit'] = false; #Combine this with change of page-layout ('127.0.0.1'=>)

Enable short URLs

This makes reading the internet addresses of your website easier

Make sure the folder of your wiki is 'w'

Add or edit the following settings in LocalSettings.php:

$wgScriptPath = "/w";         # Physical path (right part of first rewrite rule). Should already be in LocalSettings.php
$wgArticlePath = "/wiki/$1";  # Virtual path (left part of first rewrite rule). MUST be DIFFERENT from the path set above ($wgScriptPath)!
$wgUsePathInfo = true;
$wgLogo = "/w/wiki_logo.png"; # You may need adjust that to point where your logo is. Without it your logo will disappear.

Create or edit .htaccess in your web root directory (typically, public_html)

and add this to it:

RewriteEngine On
RewriteRule ^wiki/(.*)$ /w/index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ /w/index.php [L,QSA]
RewriteRule ^/*$ /w/index.php [L,QSA]

(source)

Enable mod_rewrite module (source)

cd /etc/apache2/mods-enabled/
sudo gedit rewrite.load

then add:

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so
sudo /etc/init.d/apache2 restart

Enable & configure uploads

Add this at the bottom of LocalSettings.php:

#                     Edit / uploads                       ============================
$wgEnableUploads=true;
$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg'
                         , 'xls', 'pdf', 'doc', 'ppt', 'pps'
);

Add this at the bottom of LocalSettings.php:

#                     Miscellaneous                        ============================
$wgLogo="/logo.png";

Extensions

Allthough MediaWiki is a great peace of software, some functionalities are not standard in MediaWiki. But a lot can be added by including extensions written by other people. Some extensions I include often in my wiki installations, and they are summed here

ParserFunctions

Add this to LocalSettings.php
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
Download this and add it to the wiki/extensions folder
http://www.mediawiki.org/wiki/Extension:ParserFunctions
Examples
{{#ifexist: Setup of wiki | page exists | mmmstrange }} returns 'page exists'
{{#ifexist: SomeNoneexistingPage2010 | page exists? | Page not found }} returns 'Page not found'

DynamicFunctions

Add this to LocalSettings.php
require_once( "$IP/extensions/DynamicFunctions/DynamicFunctions.php" );
Go to this URL and copy/paste the code to a file referred to above
http://www.mediawiki.org/wiki/Extension:DynamicFunctions#Code
Examples
{{#rand:100|150}} returns a number between 100 and 150, inclusive. Let's say: {{#rand:100|150}}
{{#ip}} returns the IP number of your computer, which is in this case {{#ip:}}

EmailTags

Add this to LocalSettings.php
require_once( "$IP/extensions/emailtag/emailtag.php");
Go to this URL for installation instructions and download code
http://www.mediawiki.org/wiki/Extension:Emailtag
<email>mail@example.com</email> results in some mail

ImageMap

Add this to LocalSettings.php
require_once( "$IP/extensions/ImageMap/ImageMap.php" );
Go to this URL for installation instructions and download code
http://www.mediawiki.org/wiki/Extension:ImageMap

Some other additional changes I often add

Add this at the bottom of LocalSettings.php:

hide edit-section buttons
$wgDefaultUserOptions ['editsection'] = false; # Hide edit-section links
Hide counter-info at bottom of page
Add $wgDisableCounters=true; to LocalSettings. This disables the counters at the bottom of the page (needless information)
Main menu
Go to page MediaWiki:Sidebar and edit the page to get another menu bar
Default layout
Set variable $wgDefaultSkin to another value for another default (or additionally downloaded) layout. More info at http://www.mediawiki.org/wiki/Manual:$wgDefaultSkin
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox