MediaWiki

From Linuxintro
Revision as of 04:59, 4 January 2012 by imported>ThorstenStaerk (→‎Extensions)

Mediawiki is a wiki software used by wikipedia and this wiki.

Setup

Configuration

For all configuration options in LocalSettings see http://www.mediawiki.org/wiki/Category:MediaWiki_configuration_settings.

Disable anonymous editing

To disable anonymous editing, edit LocalSetting.php. Below the line containing $wgDBpassword, add the following lines:

$wgGroupPermissions['*'    ]['edit']            = false;
$wgGroupPermissions['*'    ]['createpage']      = false;
$wgGroupPermissions['*'    ]['createtalk']      = false;

These lines disallow creating and editing pages for all groups (*), it remains allowed only for logged-in users.

Allowing pictures

If you are the only editor of a wiki (otherwise security flaws!) and want to allow pictures from all over the web, add the following line to the LocalSettings.php

$wgAllowExternalImages = true;

below the line

require_once( "includes/DefaultSettings.php" );

Allow all html tags

If you are the only editor of a wiki (otherwise security flaws!) and want to allow any html code in your wiki, read and follow http://www.mediawiki.org/wiki/Manual:%24wgRawHtml

Changing the sidebar

This is done on the application level; just edit Mediawiki:Sidebar.

beautify URL

By default, mediawiki's main page is in http://whatever/index.php/Main_Page. To get rid of "index.php", read and follow http://www.mediawiki.org/wiki/Manual:Short_URL

allow searching for short terms

On a default installation of mediawiki you cannot search for words shorter than 4 characters. So a search for "foo" will not yield results. To change this, read and follow allow searching for short terms in mediawiki.

introduce path-based navigation

Want an article foo/bar to have a heading that links to foo? http://www.mediawiki.org/wiki/Help:Subpages or http://www.mediawiki.org/wiki/Extension:BrettCrumbs

Namespaces

Namespaces in Mediawiki allow you to limit searches within a group of articles, the namespace. For setting them up, see http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces.

CSS

See MediaWiki:Common.css and MediaWiki:Monobook.css.

Google Analytics

To use mediawiki with google analytics, paste the code snippet e.g. into wfRePortTiMe in GlobalFunctIons.php.

FaceBook like buttons

See http://renareich.com/2010/04/27/adding-facebook-like-mediawiki/

Captchas

Want to open up your wiki to human beings, but not to bots? Use the Captcha plugin.

Backup

If you want to do a backup of your mediawiki installation, you need to backup the articles, the programs, the configuration files and the media file (like pictures etc.).

Articles

On the application layer:

php maintenance/dumpBackup.php --full >backup.xml

On the database layer, if your database name is wikidb:

mysqldump wikidb >wikidbdump.sql

Media files

See http://www.kefk.org/webworking/mediawiki/backup_und_restore.

Update

See http://www.mediawiki.org/wiki/Manual:Upgrading

Migrate

This describes how to migrate a wiki from one computer to another. It copies the mediawiki software and the content. Let's assume your mediawiki is running on computer earth and you want to have it running on mars.

  • copy your mediawiki software
  • on mars, delete LocalSettings.php
  • call your wiki on mars. You get the opportunity to set up your wiki.

Snapshot-mediawiki-setup.png

  • attention! If you use two mediawiki instances on one host, always use the same passwords for the database use
  • on earth, do a backup of your content to backup.xml. Copy it to your local computer.
  • log on to the wiki on mars as WikiSysop, choose Special Pages -> Import Pages and upload backup.xml.
  • all pages are imported! Look for Main_Page's history, you will find an addtional version containing earth's actual main page.
  • you may have to adjust upload_max_filesize in /etc/php5/apache2

Extensions

<html> <img src=”http://www.facebook.com/plugins/like.php?href=<?php echo urlencode($skin->mTitle->getFullURL()); ?>&layout=standard&show_faces=false&width=450&action=like&colorscheme=dark” scrolling=”no” frameborder=”0″ allowTransparency=”true” style=”border:none; overflow:hidden; width:450px; height:20px”></iframe> </html>