Difference between revisions of "MediaWiki"

From Server Knowledge Base
Jump to navigationJump to search
m
Line 1: Line 1:
A really useful tool for customisation is: domain.co.uk/wiki/Special:AllMessages
== Installation ==
== Installation ==



Revision as of 14:52, 15 January 2013

A really useful tool for customisation is: domain.co.uk/wiki/Special:AllMessages

Installation

On Unix, do the following:

mkdir /var/www/sites/domain.co.uk
cd /var/www/sites/domain.co.uk
wget http://download.wikimedia.org/mediawiki/1.20/mediawiki-1.20.2.tar.gz
tar xvzf mediawiki-*.tar.gz
cd mediawiki-1.20.2
mv mediawiki-1.20.2/* .
mv .gitreview .jshintignore .jshintrc ..
apt-get install mysql-server
apt-get install php5-mysql php-pear php5-dev php5-gd php5-imagick php5-intl libcurl3-openssl-dev libicu-dev
pecl install intl
apt-get install memcached libmemcached-dev php-auth php-mail php-mail-mime
pecl install Memcache
pear install net_smtp
vim /etc/php5/apache2/php.ini
/Dynamic

Add in the following lines:

extension=intl.so
extension=memcache.so
memcache.hash_strategy="consistent"

Choose a caching software between APC and xcache. If you want APC, use this. If you want xcache, do:

apt-get install php5-xcache
memcached -u root -d -m 2048 -l 10.0.0.40 -p 11211
/etc/init.d/apache2 restart

cd /var/www/sites chown root:root domain.co.uk/ -R cd /var/www/sites/domain.co.uk chmod 700 LocalSettings.php

apt-get install qmail

Then check this: http://www.mediawiki.org/wiki/Manual:Config_script

And go to domain.co.uk/index.php and run through the configuration. Then download the LocalSettings.php file.

http://www.mediawiki.org/wiki/Manual:Securing_database_passwords

Account confirmation

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

Upload the .tar.gz to /var/www/sites/domain.co.uk/extensions

tar -xzf ConfirmAccount.tar.gz
vim LocalSettings.php
require_once("$IP/extensions/ConfirmAccount/ConfirmAccount.php");

Exit the file and run php maintenance/update.php

To turn off "Your biography must be at least 50 words long.", as this does not use $wgAccountRequestMinWords any more:

vim /var/www/sites/domain.co.uk/extensions/ConfirmAccount/ConfirmAccount.config.php

Edit:

'Biography'       => array( 'enabled' => true, 'minWords' => 50 ),

If you get the below error when approving an account:

Could not create directory "mwstore://accountcreds-backend/accountcreds-public/1/12/123".
chown www-data:www-data images/ -R
chmod 755 images/ -R

Also check your "$wgFileExtensions = {'gif', 'png');" entry

You may need to create an array, something like this:

$wgFileExtensions = array('gif','png');

Capitalise headers and tab titles

vim domain.co.uk/skins/monobook/main.css

.portlet h5 {
        background: transparent;
        padding: 0 1em 0 .5em;
        display: inline;
        height: 1em;
/*      text-transform: lowercase; /* force text to lowercase */
/*      text-transform: uppercase; /* force text to uppercase */
        text-transform: capitalize; /* force text to proper case */
        font-size: 91%;
        font-weight: normal;
        white-space: nowrap;
}
.portlet h6 {
        background: #ffae2e;
        border: 1px solid #2f6fab;
        border-style: solid solid none solid;
        padding: 0 1em 0 1em;
/*      text-transform: lowercase; /* force text to lowercase */
/*      text-transform: uppercase; /* force text to uppercase */
        text-transform: capitalize; /* force text to proper case */
        display: block;

<pre>#p-personal ul {
        text-transform: capitalize;
#p-cactions li a {
/*      text-transform: lowercase; */
        text-transform: capitalize; /* force text to proper case */
}

Edit the Sidebar

Go to http://domain.co.uk/wiki/MediaWiki:Sidebar

Recaptcha installation

First go here and obtain a public and private key for your wiki.

Add the following to LocalSettings.php, below the inclusion of ConfirmEdit:

require_once("$IP/extensions/ConfirmEdit/ReCaptcha.php"); 
$wgCaptchaClass = 'ReCaptcha';
$wgReCaptchaPublicKey = 'your public key here';
$wgReCaptchaPrivateKey = 'your private key here';

Short URL configuration

http://www.mediawiki.org/wiki/Manual:Short_URL

vim LocalSettings.php
$wgScriptPath       = "";
$wgArticlePath      = '/wiki/$1';
$wgUsePathInfo      = true;
$wgScriptExtension  = ".php";
a2enmod rewrite
/etc/init.d/apache2 restart
vim /etc/apache2/sites-available/domain.co.uk
    RewriteEngine On
    RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteRule ^/?images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2 [L,QSA,B]

    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
    RewriteRule ^/?images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

Configure your Virtual Host extras here and add the config to the file above and LocalSettings.php: http://shorturls.redwerks.org