MediaWiki Setup Config

From richud.com
Jump to: navigation, search


MediaWiki setup

Remind me what to set up :)

Main setup

cd richud.com
sudo apt-get install svn php5-sqlite php5-gd php-apc php5-json
sudo service lightppd restart
wget http://download.wikimedia.org/mediawiki/1.18/mediawiki-1.18.0.tar.gz
tar zxvf mediawiki-1.18.0.tar.gz 
mv mediawiki-1.18.0 w
 
#logo to richud.com/w/skins/common/images/

To enable uploads

sudo chown -R xxxx:www-data w/images

sudo chmod -R +rw www-data w/images

LocalSettings.php

$wgEnableUploads = true;

Extensions

All go into w/extensions, unpack just to w/extensions as w/extensions/XXXXX will be created.

Category tree

cd ~/richud.com/w/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/CategoryTree.git

Localsettings.php

$wgUseAjax = true;

require_once("{$IP}/extensions/CategoryTree/CategoryTree.php");

Syntax code highlighting

cd ~/richud.com/w/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SyntaxHighlight_GeSHi.git

LocalSettings.php

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

RawFile

cd richud.com/w/extensions

wget -N --content-disposition "http://wiki.yobi.be/index.php?title=Mediawiki_RawFile&action=raw&file=RawFile.php"

LocalSettings.php

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

EmbedVideo

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

cd richud.com/w/extensions
git clone git://github.com/Whiteknight/mediawiki-embedvideo.git

LocalSettings.php

include_once("$IP/extensions/mediawiki-embedvideo/EmbedVideo.php");

ArticleComments

NOT USING

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

cd richud.com/w/extensions

svn export http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/ArticleComments/


Killing spam

NOT USING

In this file ArticleComments/ArticleComments.php

Below this line, function defaultArticleCommentSpamCheck( $comment, $commenterName, $commenterURL, &$isSpam ) {

Add this if(ereg('yes', file_get_contents('http://www.stopforumspam.com/api?ip='.getenv(REMOTE_ADDR)))) { return $isspam = true; }


LocalSettings.php

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

Widgets

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

cd ~/richud.com/w/extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Widgets.git
cd Widgets
git submodule init
git submodule update
sudo chown xxxxxxx:www-data ~/richud.com/w/extensions/Widgets/compiled_templates

LocalSettings.php add

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

$wgGroupPermissions['sysop']['editwidgets'] = true;

DISQUS Widget

http://www.mediawikiwidgets.org/DISQUS

Need to install Widgets plugins, then create two pages (although template doesn't need to be can just cut n paste the widget code (starting {{#widget:DISQUS ...) in to a page directly)

1) Create http://www.richud.com/wiki/Widget:DISQUS

Cut n paste code from http://www.mediawikiwidgets.org/w/index.php?title=Widget:DISQUS&action=edit into URL above (create page)

2) Create template http://www.richud.com/wiki/Template:DISQUS

Cut n paste into URL above (Create page), "replace id with site shortname"

{{#widget:DISQUS
|id=yourid
|uniqid={{PAGENAME}}
|url={{fullurl:{{PAGENAME}}}}
}}


After doing these two steps can then embedded a a Disqus page with just this template reference in the page

{{DISQUS}}

SPAM blocking

Add to LocalSettings.php to do DNS BL's

$wgEnableDnsBlacklist = true;
#$wgDnsBlacklistUrls = array( 'xbl.spamhaus.org', 'opm.tornevall.org' );
$wgDnsBlacklistUrls = array('zen.spamhaus.org');

Cleaning

sudo apt-get install php5-cli
cd ~/richud.com/w/maintenance/
sudo -u www-data php deleteOldRevisions.php --delete
sudo -u www-data php rebuildall.php

Update Mediawiki

tar xvzf mediawiki-1.22.1.tar.gz -C ~/richud.com/w/ --strip-components=1
cd ~/richud.com/w/maintenance
sudo -u www-data php update.php
sudo -u www-data php sqlite.php --vacuum