Difference between revisions of "Mediawiki"

From Jon's Wiki
Line 1: Line 1:
 +
__NOTOC__
 
== Installation ==
 
== Installation ==
  

Revision as of 07:00, 13 July 2015

Installation

This assumes Ubuntu 14.04 LTS, Mediawiki version ≥ 1.24 and a passing familiarity with Git. First, clone the core code into the target directory:

git clone http://gerrit.wikimedia.org/r/p/mediawiki/core.git mediawiki

Clone the extensions and skins. These are tracked in hundreds of separate git repositories (here, we clone the root and use git submodules to manage them):

git clone https://gerrit.wikimedia.org/r/mediawiki/skins skins-available
cd skins-available
git submodule init
cd ..

git clone https://gerrit.wikimedia.org/r/mediawiki/extensions extensions-available
cd extensions-available
git submodule init
cd ..

Now when we want an extension, say the Cite extension, we can:

cd extensions-available
git submodule update --recursive Cite
cd ../mediawiki/extensions
ln -s ../../extensions-available/Cite

Next, we need to pull in the dependencies with PHP composer.

composer install

TODO: tbc... catchy-bussy


Visual Editor

Install the Parsoid service:

apt-key advanced --keyserver keys.gnupg.net --recv-keys 5C927F7C
echo 'deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main' > /etc/apt/sources.list.d/parsoid.list 
apt-get update && apt-get install parsoid
vi /etc/mediawiki/parsoid/settings.js  # change URL to point to installed api.php

TODO: more stuff.

Caching

PHP opcache

Like any PHP application, use the opcache. If your PHP version is < 5.5 install php5-xcache, otherwise enable the built-in opcache by adding this in php.ini:

[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=0
opcache.fast_shutdown=0

MediaWiki file cache

Use the file cache, Luke. It's simple but effective. In LocalSettings.php:

$wgUseFileCache = true;
$wgFileCacheDirectory = "/var/cache/mediawiki";
$wgShowIPinHeader = false; 

And create the appropriate cache directory:

sudo mkdir -p /var/cache/mediawiki
sudo chown www-data:www-data /var/cache/mediawiki