MediaWiki

From Freelock Knowledge Base

Jump to: navigation, search

Here's the default main page for MediaWiki:

Please see documentation on customizing the interface and the User's Guide for usage and configuration help.

In addition to going through the basic configuration wizard you get when you first unpack and visit the site, we do these changes:

1. Edit the relevant Apache configuration for the virtual host, adding the following rewrite section:

       # KB wiki rewriting
       # Allow rewriting URLs
       RewriteEngine on
       # Don't rewrite requests for files in MediaWiki subdirectories,
       # MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
       RewriteCond %{REQUEST_URI} !^/kb/(stylesheets|images|skins)/
       RewriteCond %{REQUEST_URI} !^/kb/(redirect|texvc|index).php
       RewriteCond %{REQUEST_URI} !^/kb/error/(40(1|3|4)|500).html
       RewriteCond %{REQUEST_URI} !^/kb/favicon.ico
       RewriteCond %{REQUEST_URI} !^/kb/robots.txt
       #RewriteCond %{REQUEST_URI} !^/config
       # Rewrite http://wiki.domain.tld/article properly, this is the main rule
       RewriteRule ^/kb/(.*)$ /kb/index.php?title=$1 [L,QSA]
       # this rewrite rule fails on ampersands but allows question marks

Note that the relative path to any subdirectory has been added to each condition and rule, in this case "/kb/".

2. Edit the LocalSettings.php file to create links to the right scheme, ignoring the index.php stub:

## If using PHP as a CGI module, use the ugly URLs
#$wgArticlePath      = "$wgScript/$1";
$wgArticlePath      = "/kb/$1";
# $wgArticlePath      = "$wgScript?title=$1";

Note that MediaWiki can handle rewriting to either /index.php?title=$1 (can use question marks but not ampersands) or /index.php/$1 (can use ampersands but not question marks).


[edit] MediaWiki files download instead of show

When creating a MediaWiki page, I've run across some strange behavior when downloading in Firefox: instead of loading the page, it attempts to download as a "BIN" file.

The problem is related to mime types, ssl, and gzip compression. It turns out that Firefox has a bug when downloading a Gzip'd page on an ssl-encrypted site. The solution is to disable Gzip compression.

To do this:

  • Edit the LocalSettings.php to comment out this line:
       ## Compress output if the browser supports it
    #   if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );

[edit] Edit main navigation links

The main navigation links are in a special variable in the DefaultSettings.php file. To change them, copy this array to the LocalSettings.php file and edit them there.

Each link is comprised of three parts: a label, a URL, and the actual page. Put the label and URL in like this:

# Left nav links
$wgNavigationLinks = array (
       array( 'text'=>'mainpage',      'href'=>'mainpage' ),
       array( 'text'=>'emphand',       'href'=>'emphand-url' ),
       array( 'text'=>'empforms',      'href'=>'empforms-url' ),
       array( 'text'=>'portal',        'href'=>'portal-url' ),
       array( 'text'=>'currentevents', 'href'=>'currentevents-url' ),
       array( 'text'=>'recentchanges', 'href'=>'recentchanges-url' ),
       array( 'text'=>'randompage',    'href'=>'randompage-url' ),
       array( 'text'=>'help',          'href'=>'helppage' ),
       array( 'text'=>'sitesupport',   'href'=>'sitesupport-url' ),
);

The label and URL values are in the MediaWiki name space. So to add the employee forms link to this navigation, point your browser to /wiki/MediaWiki:emphand and /wiki/MediaWiki:emphand-url. Edit each of those to point to the desired page. Finally, clear your browser's cache to get the new navigation to actually show up.

[edit] Graphviz Extension

We've installed and used the [m:GraphViz] extension on our intranet, and found it to be an amazing tool for generating graphs and image maps. Here are some documentation links:

Note that there are a couple of versions of the GraphViz extension: the original one from Wickle, and the enhanced one from islandseeds. The enhanced version adds the ability to use other GraphViz rendering engines (besides Dot) and a built-in floating mechanism to float the graph to the left or right.

GraphViz is available in the [PLF] media source for Mandriva.

Personal tools