Difference between revisions of "Mediawiki installation, customization and operation"

From Madagascar
Jump to navigation Jump to search
 
(16 intermediate revisions by 2 users not shown)
Line 9: Line 9:
 
==Customization==
 
==Customization==
  
===Favicon and logo===
+
===Logo===
 
In <tt>LocalSettings.php</tt>, set  
 
In <tt>LocalSettings.php</tt>, set  
<php>
+
<syntaxhighlight lang="php">
$wgFavicon = '/wikilocal/style/favicon.png';
 
 
$wgLogo    = '/wikilocal/style/Madagascar2.png';
 
$wgLogo    = '/wikilocal/style/Madagascar2.png';
</php>
+
</syntaxhighlight>
  
===Footer===
+
===Extensions===
To insert the images/links to the Ohloh, Sourceforge and Cafepress, edit <tt>includes/Skin.php</tt> to replace the default function <tt>getPoweredBy()</tt> with:
+
These are installed in the <tt>extensions</tt> directory. Currently installed extensions are:
  
<php>
+
* [https://www.mediawiki.org/wiki/Extension:Nuke Nuke] Gives administrators the ability to mass delete pages
        function getPoweredBy() {
+
* [https://www.mediawiki.org/wiki/Extension:Translate Translate]    Special page for translating MediaWiki
                global $wgStylePath;
+
* [https://www.mediawiki.org/wiki/Extension:Babel Babel] Adds the #babel parser function to allow automated generation of a babel userbox column with the ability to include custom templates
                $ohloh = '<script type="text/javascript" src="http://www.ohloh.net/p/348236/widgets/project_thin_badge.js"></script>';
+
* [https://www.mediawiki.org/wiki/Extension:Cite Cite] Adds <<nowiki />ref[ name=id]> and <<nowiki />references/> tags, for citations
                $sf1='<a href="http://sourceforge.net/projects/rsf">';
+
* [https://www.mediawiki.org/wiki/Extension:Math Math] Render mathematical formulas between <<nowiki />math> ... <<nowiki />/math> tags
                $sf2='<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=162909&amp;type=13" width="120" height="30" border="0" ';
+
* [https://www.mediawiki.org/wiki/Extension:RSS RSS feed]      Displays RSS feeds on MediaWiki pages
                $sf3='alt="Get Madagascar at SourceForge.net. Fast, secure and Free Open Source software downloads"/></a> ';
+
* [https://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi SyntaxHighlight] Provides syntax highlighting <<nowiki />syntaxhighlight> using GeSHi - Generic Syntax Highlighter
                $sourceforge = $sf1.$sf2.$sf3;
+
* [http://www.mediawiki.org/wiki/Extension:Widgets Widgets] Allows wiki administrators to add free-form widgets to wiki
                $url = htmlspecialchars( "$wgStylePath/common/images/poweredby_mediawiki_88x31.png" );
+
* [https://www.mediawiki.org/wiki/Extension:ConfirmEdit ConfirmEdit] Provides CAPTCHA techniques to protect against spam and password-guessing
                $banner = htmlspecialchars( "/wikilocal/style/store.png" );
+
* [https://www.mediawiki.org/wiki/Extension:CleanChanges Clean Changes] More compact display of the recent changes list
                $store = '<a href="http://www.cafepress.com/m8r">
+
* [https://www.mediawiki.org/wiki/Extension:Google_Analytics_Integration Google Analytics Integration] Inserts Google Analytics script (ga.js) in to MediaWiki pages for tracking
                <img src="'.$banner.'" width="88" height="31" border="0" alt="Madagascar Store" /></a> ';
+
* [https://www.mediawiki.org/wiki/Extension:CLDR Language Names] Extension which provides localised language names based on CLDR data
                $img = $ohloh.$sourceforge.$store.'<a href="http://www.mediawiki.org/"><img src="'.$url.'" alt="MediaWiki" /></a>';
+
* [https://www.mediawiki.org/wiki/Extension:LocalisationUpdate LocalisationUpdate]  Keeps the localised messages as up to date as possible
                return $img;
+
* [https://www.mediawiki.org/wiki/Extension:UniversalLanguageSelector UniversalLanguageSelector] Gives the user several ways to select a language and to adjust language settings
        }
 
</php>
 
  
 
==Operation==
 
==Operation==
Line 40: Line 37:
 
Backups should cover the wiki installation (SQL backups must be made by proper script, not by simply copying a file!), as well as a static copy of a wiki to be used in case the database is corrupted during file transfer.
 
Backups should cover the wiki installation (SQL backups must be made by proper script, not by simply copying a file!), as well as a static copy of a wiki to be used in case the database is corrupted during file transfer.
 
===Defending against spammers and vandals===
 
===Defending against spammers and vandals===
 +
 +
The best method is QuestyCaptcha.
 +
 +
<syntaxhighlight lang="php">
 +
require_once "$IP/extensions/ConfirmEdit/QuestyCaptcha.php";
 +
$wgCaptchaClass = 'QuestyCaptcha';
 +
</syntaxhighlight>
 +
 
====Allowing only registered users to edit the wiki====
 
====Allowing only registered users to edit the wiki====
 
This is a measure that was deemed necessary after two years of daily undo-and-block warfare against spammers.
 
This is a measure that was deemed necessary after two years of daily undo-and-block warfare against spammers.
To set or unset it,
+
To set it, use in <tt>LocalSettings.php</tt>:
 +
<syntaxhighlight lang="php">
 +
$wgGroupPermissions['*']['edit'] = false;
 +
$wgGroupPermissions['*']['createpage'] = false;
 +
$wgGroupPermissions['*']['createtalk'] = false;
 +
</syntaxhighlight>
 +
 
 
====Disabling registration of new users====
 
====Disabling registration of new users====
 
This is a temporary measure, to be used as a stopgap against large attacks, until a permanent effective measure has been found.
 
This is a temporary measure, to be used as a stopgap against large attacks, until a permanent effective measure has been found.
 
====Disallowing users to create new pages====
 
====Disallowing users to create new pages====
 
Again, a temporary measure. For attacks which are not so heavy as to warrant disabling registration of new users, and in which spammers are weeded out manually. Several hours may pass between verifications of edits, in which a spammer can create many new pages. Works for attacks centered on new page creation. To set this, use  
 
Again, a temporary measure. For attacks which are not so heavy as to warrant disabling registration of new users, and in which spammers are weeded out manually. Several hours may pass between verifications of edits, in which a spammer can create many new pages. Works for attacks centered on new page creation. To set this, use  
<php>
+
<syntaxhighlight lang="php">
 
$wgGroupPermissions['user']['createpage'] = false;
 
$wgGroupPermissions['user']['createpage'] = false;
</php>
+
</syntaxhighlight>
 
in <tt>LocalSettings.php</tt> .
 
in <tt>LocalSettings.php</tt> .
  
 
====Disabling media uploads====
 
====Disabling media uploads====
 
To disable uploads via the web interface, set
 
To disable uploads via the web interface, set
<php>
+
<syntaxhighlight lang="php">
 
$wgEnableUploads = false;
 
$wgEnableUploads = false;
</php>
+
</syntaxhighlight>
 
in <tt>LocalSettings.php</tt> .
 
in <tt>LocalSettings.php</tt> .
 +
To upload images from the command line, without using the web interface, use
 +
<syntaxhighlight lang="bash">
 +
php wiki/maintenance/importImages.php /path/to/dir/with/images extensions
 +
</syntaxhighlight>
 +
If file permission problems are encountered, then
 +
<syntaxhighlight lang="bash">
 +
chmod -R g+w wiki/images
 +
</syntaxhighlight>

Latest revision as of 04:33, 16 September 2015

Installation

The Madagascar Mediawiki installation consists of:

  • A SQL database back-end, that holds text, images, history and user data
  • A set of PHP scripts, that dynamically generate the HTML pages
  • Auxiliary files uploaded directly to the server

Advanced web hosting providers offer "one-click" installs of Mediawiki, but database migration and PHP customization must still be performed.

Customization

In LocalSettings.php, set

$wgLogo    = '/wikilocal/style/Madagascar2.png';

Extensions

These are installed in the extensions directory. Currently installed extensions are:

  • Nuke Gives administrators the ability to mass delete pages
  • Translate Special page for translating MediaWiki
  • Babel Adds the #babel parser function to allow automated generation of a babel userbox column with the ability to include custom templates
  • Cite Adds <ref[ name=id]> and <references/> tags, for citations
  • Math Render mathematical formulas between <math> ... </math> tags
  • RSS feed Displays RSS feeds on MediaWiki pages
  • SyntaxHighlight Provides syntax highlighting <syntaxhighlight> using GeSHi - Generic Syntax Highlighter
  • Widgets Allows wiki administrators to add free-form widgets to wiki
  • ConfirmEdit Provides CAPTCHA techniques to protect against spam and password-guessing
  • Clean Changes More compact display of the recent changes list
  • Google Analytics Integration Inserts Google Analytics script (ga.js) in to MediaWiki pages for tracking
  • Language Names Extension which provides localised language names based on CLDR data
  • LocalisationUpdate Keeps the localised messages as up to date as possible
  • UniversalLanguageSelector Gives the user several ways to select a language and to adjust language settings

Operation

Backups

Backups should cover the wiki installation (SQL backups must be made by proper script, not by simply copying a file!), as well as a static copy of a wiki to be used in case the database is corrupted during file transfer.

Defending against spammers and vandals

The best method is QuestyCaptcha.

require_once "$IP/extensions/ConfirmEdit/QuestyCaptcha.php";
$wgCaptchaClass = 'QuestyCaptcha';

Allowing only registered users to edit the wiki

This is a measure that was deemed necessary after two years of daily undo-and-block warfare against spammers. To set it, use in LocalSettings.php:

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

Disabling registration of new users

This is a temporary measure, to be used as a stopgap against large attacks, until a permanent effective measure has been found.

Disallowing users to create new pages

Again, a temporary measure. For attacks which are not so heavy as to warrant disabling registration of new users, and in which spammers are weeded out manually. Several hours may pass between verifications of edits, in which a spammer can create many new pages. Works for attacks centered on new page creation. To set this, use

$wgGroupPermissions['user']['createpage'] = false;

in LocalSettings.php .

Disabling media uploads

To disable uploads via the web interface, set

$wgEnableUploads = false;

in LocalSettings.php . To upload images from the command line, without using the web interface, use

php wiki/maintenance/importImages.php /path/to/dir/with/images extensions

If file permission problems are encountered, then

chmod -R g+w wiki/images