Mediawiki <math> support with PHP safe_mode
===========================================

Author: Mattias Guns <tias@ulyssis.org>
http://xylofaan.ulyssis.org/patch/mediawiki/math_safe_mode/

These are the steps I had to take to get <math> support
working an a box that uses PHP safe_mode.

1) safe_mode_exec_dir
---------------------
First off, check what the value of the PHP setting
`safe_mode_exec_dir` is.
* No safe_mode_exec_dir
  Edit the apache config of your virtual host, and set
  it to the math directory of your mediawiki installation:
	php_admin_value safe_mode_exec_dir /srv/www/wiki/math/
* safe_mode_exec_dir is set to some directory
  Make sure you can add something in it.

2) patch includes/Math.php
--------------------------
It uses backticks ` ` to execute the command, this doesn't
work in safe mode, apply the patch named:
 includes_Math.php_safemode.patch
It uses exec() but also drops the escaping which, for some
reason, is necessary.
It also ignores checking if the created file exists, which is
necessary if you don't want (or can't) add that directory to
`safe_mode_include_dir`.

3) copy the texvc-wrapper script
--------------------------------
Because the data is not escaped, spaces in the latex code
confuse texvc. I have written a wrapper that fixes this
by grouping the arguments the right way, copy this wrapper
script `texvc-wrapper` to the directory set in the PHP value
`safe_mode_exec_dir`.
Next, edit the wrapper script so that the `TEXVC` points to
the texfc executable of your installation.
Don't forget to make the wrapper executable ; )

4) edit your LocalSettings.php
------------------------------
Lastly, edit your LocalSettings.php:
# Of course, enable <math> support
$wgUseTeX			= true;
# enable the features provided by the patch
define('FIX_TEX_SAFE_MODE', 1);
# point the Texvc var to the wrapper script
$wgTexvc            = "{$IP}/math/texvc-wrapper";
