Difference between revisions of "Mediawiki Plugin"

From FusionForge Wiki
Jump to: navigation, search
(Manual MediaWiki export by site admin: update paths)
Line 77: Line 77:

Latest revision as of 12:43, 22 September 2015

Mediawiki Plugin
Plugin to use the "Mediawiki" (mediawiki) wiki. Plugin available since FusionForge 4.7.x .
Plugin Changelog
Plugin Changelog for mediawiki
actively maintained
Matrix by Fusionforge Version and by Linux Distribution
distribution\version 4.8.x 5.0.x 5.1.x 5.2.x 5.3.x 6.0.x master
Debian undefined undefined undefined undefined undefined undefined undefined
CentOS undefined undefined undefined undefined undefined undefined undefined

See the plugin's README on the master/trunk for some details about the plugin.

The authentication for MediaWiki is adapted to use the FusionForge user credentials. See http://lists.fusionforge.org/pipermail/fusionforge-general/2011-October/001589.html for more details.

Using the API

The API is available to interact with the wikis programmatically. It can be accessed through the api.php, instead of the regular index.php.

In the case when ACLs of a project restrict permissions to read the contents of the wiki to authenticated users and/or members of the project, most calls to the API may fail with a read permission error. This can be solved by first authenticating the client to fusionforge, and reusing the session cookies for access to the API. See https://lists.fusionforge.org/pipermail/fusionforge-general/2014-March/002641.html for an example in Python.

To be able to use the methods requiring logging-in to the API, the login action will need to be invoked with a username/password pair, where the username will be the capitalized version of the fusionforge username (as displayed in the user's page link in top/right corner of wiki pages, when authenticated), and where the password will have to be set by a forge system administrator.

Defining mediawiki user's password for API login

Currently, the authentication system for the mediawiki embedded through the fusionforge plugin doesn't provide its users will real passwords (or, more precisely, a random password is generated at user's first login), so a password needs to be set explicitely by a system administrator in the mediawiki database, using the following invocation inside the plugin's directory :

# cd .../plugins/mediawiki
# bin/mw-wrapper.php projname changePassword.php --user=Theuser --password=NEWPASSWORD

Configuration paths

These files are read in order:

  • {core:config_path}/plugins/mediawiki/LocalSettings.php: site-wide and project-specific extra-settings
  • /etc/mediawiki-extensions/extensions.php: debian style system-wide mediawiki extensions
  • {mediawiki:mwdata_path}/ForgeSettings.php: forge global settings
  • {mediawiki:projects_path}/your_project/ProjectSettings.php: project specific settings

E.g. in a Debian install:

  • /etc/fusionforge/plugins/mediawiki/LocalSettings.php
  • /etc/mediawiki-extensions/extensions.php -> /etc/mediawiki-extensions/extensions-enabled/Math.php
  • /var/lib/fusionforge/plugins/mediawiki/ForgeSettings.php
  • /var/lib/fusionforge/plugins/mediawiki/projects/siteadmin/ProjectSettings.php

Import export

User export

Automated MediaWiki import/export by site admin

We provide scripts for full export (pages and files) and import (pages, files and index regeneration):

  • $source_dir/plugins/mediawiki/bin/mw-fulldump
  • $source_dir/plugins/mediawiki/bin/mw-fullrestore

Manual MediaWiki export by site admin

If you need to do the above manually (TODO: do we need --logs?):

/usr/share/fusionforge/plugins/mediawiki/bin/mw-wrapper.php $PROJECT dumpBackup.php --full | gzip > $PROJECT.xml.gz
  • Attachments export:
tar czf $PROJECT-attachments.tar.gz -C /var/lib/fusionforge/plugins/mediawiki/projects/ $PROJECT

Note: if needed, one may export using SQL format - but if that's for a project admin, it may be needed to anonymize data stored by MediaWiki (IP addresses...), so prefer an XML dump, but for reference : pg_dump -n plugin_mediawiki_$PROJECT fusionforge | gzip > plugin_mediawiki_$PROJET.sql.gz.

Data import from other wikis

See for instance the TWiki to Mediawiki converter at : https://fusionforge.int-evry.fr/projects/pytwiki2mediawi/ which uses the API in a Python script to perform imports of pages and attachments.

Known issues

  • Pages with unbreakable space in their title are marked as empty following a mediawiki upgrade from Debian 1:1.15.5-2squeeze6 to 1:1.19.15+dfsg-0+deb7u1. I had to manually fix the database:
SET SCHEMA 'plugin_mediawiki_PROJECT';
UPDATE page SET page_title=replace(page_title, E'\302\240', '_') WHERE page_title LIKE E'%\302\240%';