How to install and configure this wiki

From Gender and Tech Resources

Installation of the wiki

Dependencies

From a freshly install debian testing 64 bits

[*] Web server
[*] SSH server
[*] Standard system utility
su
apt-get update
apt-get upgrade
apt-get install php5 phpmyadmin mysql-server php5-intl php-patchwork-utf8 imagemagick git curl

For e-mail

apt-get install php-pear
pear install mail
pear install Net_SMTP
dpkg-reconfigure exim4-config

/!\ have to check the mail config so as not to be considered as spam (headers, text of the mail ...)

Download mediawiki

wget http://releases.wikimedia.org/mediawiki/1.24/mediawiki-1.24.2.tar.gz
tar xvzf mediawiki-1.24.2.tar.gz -C /var/www/html/wiki
mv mediawiki-1.24.2 /var/www/html/wiki

Finish mediawiki configuration

open in a browser http://127.0.0.1/wiki/

and install threw this process the following extensions :

# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
# The following extensions were automatically enabled:
require_once "$IP/extensions/Cite/Cite.php";
require_once "$IP/extensions/Gadgets/Gadgets.php";
require_once "$IP/extensions/ImageMap/ImageMap.php";
require_once "$IP/extensions/InputBox/InputBox.php";
require_once "$IP/extensions/Nuke/Nuke.php";
require_once "$IP/extensions/ParserFunctions/ParserFunctions.php";
require_once "$IP/extensions/Renameuser/Renameuser.php";
require_once "$IP/extensions/SpamBlacklist/SpamBlacklist.php";
require_once "$IP/extensions/SyntaxHighlight_GeSHi/SyntaxHighlight_GeSHi.php";
require_once "$IP/extensions/TitleBlacklist/TitleBlacklist.php";


# End of automatically generated settings.
# Add more configuration options below.

Configurations

Upload settings

allow apache to write in the upload folder

chown -R www-data:www-data /var/www/html/gtwiki/images

Modify the php.ini file

nano /etc/php5/apache2/php.ini

line 660

post_max_size = 100M

line 810

upload_max_filesize = 100M

line 1002

mail.log = syslog

Modify the Localsettings.php file

#####################################################################
# Increase Shell memory (default 100 MB)                            #
#####################################################################

$wgMaxShellMemory = 512000;
#####################################################################
# User configuration : only email confirmed users can edit & upload #
#####################################################################
# doc: http://www.mediawiki.org/wiki/Manual:User_rights_management
# Sign up for a new account
$wgGroupPermissions['*']['createaccount']=false;
# Edit once email is confirmed
$wgGroupPermissions['*']['edit']=false;
$wgGroupPermissions['*']['createpage']=false;
$wgGroupPermissions['*']['createtalk']=false;
$wgGroupPermissions['emailconfirmed']['upload'] = true; // Allow regular users to upload files
#$wgGroupPermissions['*']['upload_by_url'] = true;
$wgGroupPermissions['autoconfirmed']['upload_by_url'] = true;
$wgGroupPermissions['emailconfirmed']['edit'] = true;
require_once "$IP/extensions/ConfirmAccount/ConfirmAccount.php";
$wgMakeUserPageFromBio = false;
$wgAutoWelcomeNewUsers = false;
$wgConfirmAccountRequestFormItems = array(
       'UserName'        => array( 'enabled' => true ),
       'RealName'        => array( 'enabled' => false ),
       'Biography'       => array( 'enabled' => false, 'minWords' => 30 ),
       'AreasOfInterest' => array( 'enabled' => false ),
       'CV'              => array( 'enabled' => false ),
       'Notes'           => array( 'enabled' => true ),
       'Links'           => array( 'enabled' => false ),
       'TermsOfService'  => array( 'enabled' => false ),
);
$wgConfirmAccountContact = 'alexandra@tacticaltech.org';
$wgConfirmAccountContact = 'benjamin@labomedia.org';
#####################################################################
# Upload configuration : only some mime types are allowed           #
#####################################################################
# doc: https://www.mediawiki.org/wiki/Manual:Configuration_settings#Uploads
$wgEnableUploads = true;
$wgAllowCopyUploads = true;
$wgCopyUploadsFromSpecialUpload = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgFileExtensions = array( 'bmp', 'doc', 'docx', 'flac', 'gif', 'ico', 'jpeg', 'jpg', 'mp3', 'mpp', 'odg', 'odp', 'ods', 'odt', 'ogg', 'pdf', 'epub', 'png', 'ppt', 'pptx', 'ps', 'rtf', 'svg$
$wgAllowJavaUploads = true; // Solves problem with Office 2007 and newer files (docx, xlsx, etc.)
$wgMimeDetectorCommand = "file -bi";
$wgVerifyMimeType = false;

Extensions

go into the extension directory

cd /var/www/html/gtwiki/extensions

MsUpload

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MsUpload.git
# MsUpload https://www.mediawiki.org/wiki/Extension:MsUpload
require_once "$IP/extensions/MsUpload/MsUpload.php";
$wgMSU_showAutoCat = true; // If true, files uploaded while editing a category will be added to that category
$wgMSU_checkAutoCat = true; // Whether the checkbox for the above mentioned case is checked by default
$wgMSU_imgParams = '400px'; // The default parameters for inserted images
$wgMSU_useDragDrop = true; // Should the drag & drop area be shown?
$wgMSU_useMsLinks = false; // Should we allow to insert links in the style of the Extension:MsLinks?

PdfHandler

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/PdfHandler.git
# PdfHandler https://www.mediawiki.org/wiki/Extension:PdfHandler
require_once "$IP/extensions/PdfHandler/PdfHandler.php";
$wgPdfProcessor = '/usr/bin/gs'; 
$wgPdfPostProcessor = $wgImageMagickConvertCommand; // if defined via ImageMagick
// $wgPdfPostProcessor = '/usr/bin/convert';  // if not defined via ImageMagick
$wgPdfInfo = '/usr/bin/pdfinfo'; 
$wgPdftoText = '/usr/bin/pdftotext';

Add "case 'pdf':" ligne 122 in extensions/MsUpload.js :

        if ( $.inArray( file.extension, wgFileExtensions ) !== -1 ) {
                switch( file.extension ) {
                        case 'jpg': case 'jpeg': case 'png': case 'gif': case 'bmp': case 'tif': case 'tiff': case 'pdf': // pictures

ConfirmEdit

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ConfirmEdit.git
# ConfirmEdit https://www.mediawiki.org/wiki/Extension:ConfirmEdit
require_once "$IP/extensions/ConfirmEdit/ConfirmEdit.php";
require_once "$IP/extensions/ConfirmEdit/QuestyCaptcha.php";
$wgCaptchaClass = 'QuestyCaptcha';
$wgCaptchaQuestions[] = array(
  'question' => "What is the first word in the name of this wiki (lowercase) ?",
  'answer' => "gender");
$wgGroupPermissions['emailconfirmed']['skipcaptcha'] = true;
$ceAllowConfirmedEmail = true;
$wgEmailConfirmToEdit = true;

WikiEditor

for mediawiki 1.24

wget https://extdist.wmflabs.org/dist/extensions/WikiEditor-REL1_24-b13e25d.tar.gz
tar -xzf WikiEditor-REL1_24-b13e25d.tar.gz -C /var/www/html/wiki/extensions/
rm WikiEditor-REL1_24-b13e25d.tar.gz
# WikiEditor https://www.mediawiki.org/wiki/Extension:WikiEditor
require_once "$IP/extensions/WikiEditor/WikiEditor.php";
## Enables use of WikiEditor by default but still allow users to disable it in preferences
$wgDefaultUserOptions['usebetatoolbar'] = 1;
$wgDefaultUserOptions['usebetatoolbar-cgd'] = 1;
## Displays the Preview and Changes tabs
$wgDefaultUserOptions['wikieditor-preview'] = 1;
## Displays the Publish and Cancel buttons on the top right side
$wgDefaultUserOptions['wikieditor-publish'] = 1;

AdminLinks

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git
# Admin links https://www.mediawiki.org/wiki/Extension:Admin_Links
require_once("$IP/extensions/AdminLinks/AdminLinks.php");

Replace Text

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ReplaceText.git
# Replace Text https://www.mediawiki.org/wiki/Extension:Replace_Text
require_once( "$IP/extensions/ReplaceText/ReplaceText.php" );

EmbedVideo

git clone https://github.com/Alexia/mediawiki-embedvideo.git
mv mediawiki-embedvideo/ /var/www/html/wiki/extensions/EmbedVideo
# EmbedVideo http://www.mediawiki.org/wiki/Extension:EmbedVideo
require_once "$IP/extensions/EmbedVideo/EmbedVideo.php";

NiceCategoryList

cd /var/www/html/wiki/extensions/
mkdir NiceCategoryList2
cd NiceCategoryList/
nano NiceCategoryList.php

paste in the file the content of : http://www.mediawiki.org/wiki/Extension:NiceCategoryList2/3.0 (! no git nor downloadable v3 file ...)

# NiceCategoryList http://www.mediawiki.org/wiki/Extension:NiceCategoryList2
include_once("$IP/extensions/NiceCategoryList/NiceCategoryList.php");

DynamicPageList

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/intersection.git intersection
# Dynamic Page List https://www.mediawiki.org/wiki/Extension:DynamicPageList_%28Wikimedia%29
require_once("$IP/extensions/intersection/DynamicPageList.php");
# Configuration variables. Warning: These use DLP instead of DPL
# for historical reasons (pretend Dynamic list of pages)
$wgDLPmaxCategories = 6;                // Maximum number of categories to look for
$wgDLPMaxResultCount = 200;             // Maximum number of results to allow
$wgDLPAllowUnlimitedResults = false;    // Allow unlimited results
$wgDLPAllowUnlimitedCategories = false; // Allow unlimited categories
// How long to cache pages using DPL's in seconds. Default to 1 day. Set to
// false to use the normal amount of page caching (most efficient), Set to 0 to disable
// cache altogether (inefficient, but results will never be outdated)
$wgDLPMaxCacheTime = 60*60*24;          // How long to cache pages in seconds

SelectCategory

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SelectCategory.git
# SelectCategory https://www.mediawiki.org/wiki/Extension:SelectCategory
require_once( 'extensions/SelectCategory/SelectCategory.php' );

Collection to generate books and PDF

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Collection.git

or

wget https://extdist.wmflabs.org/dist/extensions/Collection-REL1_24-f0686fd.tar.gz
tar -xzf Collection-REL1_24-f0686fd.tar.gz -C /var/www/html/wiki/extensions/
rm Collection-REL1_24-f0686fd.tar.gz
# Collection PDF https://www.mediawiki.org/wiki/Extension:Collection
require_once "$IP/extensions/Collection/Collection.php";

Install a render server to generate PDF and ODF

Collection + render server

Installation mwlib

apt-get install python-pip python-dev libxml2-dev libxslt-dev python-dev lib32z1-dev imagemagick
pip install -i http://pypi.pediapress.com/simple/ mwlib
pip install -i http://pypi.pediapress.com/simple/ mwlib.rl
pip install -i http://pypi.pediapress.com/simple/ pyfribidi

Tests

mw-zip -c :en -o test.zip Acdc Number
mw-render -c test.zip -o test.pdf -w rl
mw-render --list-writers

Fetching the content

mw-zip -c https://gendersec.tacticaltech.org/wiki/ -o completemanual.zip 'Complete manual'

Rendering

 mw-render -c completemanual.zip -o completemanual.pdf -w rl
http://mwlib.readthedocs.org/en/latest/commands.html

Running a renderserver

Semantic MediaWiki

Install

https://www.semantic-mediawiki.org/wiki/Help:Installation/Using_Composer_with_MediaWiki_1.22%2B 1. First, install composer :

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

2. Run the installation scriptfrom the base directory of your MediaWiki installation:

cd /var/www/html/gtwiki
composer require mediawiki/semantic-media-wiki "~2.1"

3. Run the setup script from the base directory of your MediaWiki installation:

php maintenance/update.php

4. Add a call to enableSemantics() to the end of the "LocalSettings.php" file. enableSemantics() takes in the domain name of the wiki; a wiki located at "example.org", for instance, should have the following call:

nano /var/www/html/gtwiki/LocalSettings.php
enableSemantics( 'tacticaltech.org/gtwiki' );

Update

Use these instructions to update an existing SMW installation.

  1. Backup your database and installation.
  2. Run the update script from the base directory of your MediaWiki installation:
    php composer.phar update
  3. See the page "Special:Version" on your wiki to verify that the extension was successfully updated.
  4. Run the setup script from the base directory of your MediaWiki installation:
    php maintenance/update.php
  5. Run the refresh database script from the base directory of your MediaWiki installation: This is an optional step to take to assure that the semantic store is valid and up to date.</ref>
    php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
  6. Done!

Semantic Drilldown

# Semantic Drilldown https://www.mediawiki.org/wiki/Extension:Semantic_Drilldown
include_once("$IP/extensions/SemanticDrilldown/SemanticDrilldown.php");

Semantic Forms

git clone https://git.wikimedia.org/git/mediawiki/extensions/SemanticForms.git
# Semantic Forms https://www.mediawiki.org/wiki/Extension:Semantic_Forms
include_once "$IP/extensions/SemanticForms/SemanticForms.php";

Semantic Forms Inputs

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git
# Semantic Forms Inputs https://www.mediawiki.org/wiki/Extension:Semantic_Forms_Inputs
require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php");


Semantic Compound Queries

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticCompoundQueries.git
# Semantic Compound Queries http://www.mediawiki.org/wiki/Extension:Semantic_Compound_Queries
require_once( "$IP/extensions/SemanticCompoundQueries/SemanticCompoundQueries.php" );

Data transfer

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataTransfer.git
# Data Transfer https://www.mediawiki.org/wiki/Extension:Data_Transfer
include_once "$IP/extensions/DataTransfer/DataTransfer.php";

Maps

cd /var/www/html/wiki/
composer require mediawiki/maps "*"

it doesn't require any call in the LocalSettings.php as composer mecanism autoload it

# Maps http://www.mediawiki.org/wiki/Extension:Maps
# https://github.com/JeroenDeDauw/Maps/blob/master/docs/INSTALL.md


Semantic Maps

cd /var/www/html/wiki/
composer require mediawiki/semantic-maps "*"

it doesn't require any call in the LocalSettings.php as composer mecanism autoload it

# Semantic Maps https://www.mediawiki.org/wiki/Extension:Semantic_Maps
# https://github.com/SemanticMediaWiki/SemanticMaps/blob/master/docs/INSTALL.md

Language Bundle

https://www.mediawiki.org/wiki/MediaWiki_Language_Extension_Bundle

cd /var/www/html/wiki/extensions
for ext in Babel cldr CleanChanges LocalisationUpdate Translate UniversalLanguageSelector
do
  if [ ! -d "$ext" ]
  then
    git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/$ext.git
  fi
  cd $ext; git fetch --tags; git checkout 2015.03; cd ..
done

Modify the LocalSettings.php

# Language Bundle https://www.mediawiki.org/wiki/MediaWiki_Language_Extension_Bundle
require_once "$IP/extensions/Babel/Babel.php";

require_once "$IP/extensions/cldr/cldr.php";

require_once "$IP/extensions/CleanChanges/CleanChanges.php";
$wgCCTrailerFilter = true;
$wgCCUserFilter = false;
$wgDefaultUserOptions['usenewrc'] = 1;

require_once "$IP/extensions/LocalisationUpdate/LocalisationUpdate.php";
$wgLocalisationUpdateDirectory = "$IP/cache";

require_once "$IP/extensions/Translate/Translate.php";
$wgGroupPermissions['emailconfirmed']['translate'] = true;
$wgGroupPermissions['emailconfirmed']['translate-messagereview'] = true;
$wgGroupPermissions['emailconfirmed']['translate-groupreview'] = true;
$wgGroupPermissions['emailconfirmed']['translate-import'] = true;
$wgGroupPermissions['sysop']['pagetranslation'] = true;
$wgGroupPermissions['sysop']['translate-manage'] = true;
$wgTranslateDocumentationLanguageCode = 'qqq';
$wgExtraLanguageNames['qqq'] = 'Message documentation'; # No linguistic content. Used for documenting messages

require_once "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php";

And then proceed to the following

Update database tables

Command line

In the directory where your LocalSettings.php is located, run the following command:

php maintenance/update.php

Web browser

Go to example.com/mediawiki/mw-config/ by using your domain and path and rerun install.

Configuring LocalisationUpdate

If you are on unix-like system, you should add LocalisationUpdate to crontab:

crontab -e
# Add the following line
@daily php /path/to/your/wiki/extensions/LocalisationUpdate/update.php --quiet

VisualEditor

Dependencies

VisualEditor depends on the following extension:

To install it, do as root :

gpg --keyserver keys.gnupg.net --recv-keys 5C927F7C
gpg -a --export 5C927F7C | apt-key add -
nano /etc/apt/sources.list file

Add the parsoid repository to your /etc/apt/sources.list file

deb [arch=amd64] http://parsoid.wmflabs.org:8080/deb wmf-production main

To install,

sudo apt-get update && sudo apt-get install parsoid
nano /etc/mediawiki/parsoid/settings.js

Open the config file in /etc/mediawiki/parsoid/settings.js and update it to reflect your API URL

parsoidConfig.setInterwiki( 'localhost', 'http://localhost/gtwiki/api.php' );

Installation

the git version is for mediawiki 1.25

wget https://extdist.wmflabs.org/dist/extensions/VisualEditor-REL1_24-af11aa1.tar.gz
tar -xzf VisualEditor-REL1_24-af11aa1.tar.gz -C /var/www/html/wiki/extensions
rm VisualEditor-REL1_24-af11aa1.tar.gz

Add the following lines to your wiki's LocalSettings.php after you have downloaded the extension:

# VisualEditor http://www.mediawiki.org/wiki/Extension:VisualEditor
require_once "$IP/extensions/VisualEditor/VisualEditor.php";
// Enable by default for everybody
$wgDefaultUserOptions['visualeditor-enable'] = 1;
// Don't allow users to disable it
$wgHiddenPrefs[] = 'visualeditor-enable';
// OPTIONAL: Enable VisualEditor's experimental code features
#$wgDefaultUserOptions['visualeditor-enable-experimental'] = 1;

To get VisualEditor to talk to Parsoid, add the following code to your LocalSettings.php to specify your Parsoid instance:

// URL to the Parsoid instance
// MUST NOT end in a slash due to Parsoid bug
// Use port 8142 if you use the Debian package
$wgVisualEditorParsoidURL = 'http://localhost:8142';

/!\ Restart Parsoid after install /!\

/etc/init.d/parsoid restart

MwEmbed

git clone https://github.com/kaltura/mwEmbed.git
mkdir cache
chown www-data:www-data cache/
# MwEmbed https://github.com/kaltura/mwEmbed
// Auth testing sets
$wgKalturaAuthHTTPS = false;
$wgKalturaAuthDomains = array( 'localhost', 'kgit.html5video.org', 'html5video.org', 'player.kaltura.com' );

MwEmbedSupport

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/MwEmbedSupport.git
# MwEmbedSupport https://www.mediawiki.org/wiki/Extension:MwEmbedSupport
require_once "$IP/extensions/MwEmbedSupport/MwEmbedSupport.php";


TimedMediaHandler

apt-get install libav-tools ffmpeg2theora oggvideotools
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/TimedMediaHandler.git
# TimedMediaHandler https://www.mediawiki.org/wiki/Extension:TimedMediaHandler
// TimedMediaHandler is dependent on mwEmbedSupport 
// TimedMediaHandler
require_once( "$IP/extensions/TimedMediaHandler/TimedMediaHandler.php" );

This extension also requires schema changes, so run update.php after installing.

cd /var/www/html/wiki
php maintenance/update.php

Skins

Foreground

cd /var/www/html/wiki/skins
git clone https://github.com/thingles/foreground.git
# Foreground https://github.com/thingles/foreground
require_once "$IP/skins/foreground/foreground.php";

A quick modification to the css :

To allow the box of the different parts to behave as expected even if the contents of the boxes don't have the same length

https://gendersec.tacticaltech.org/wiki/index.php/MediaWiki:Common.css

.activities,
.storytelling {
	clear:left;
}