Mudanças entre as edições de "Math safe mode"

De WikiLICC
Ir para: navegação, pesquisa
Linha 6: Linha 6:
 
These are the steps I had to take to get <nowiki><math></nowiki> support working an a box that uses PHP safe_mode.
 
These are the steps I had to take to get <nowiki><math></nowiki> support working an a box that uses PHP safe_mode.
  
# safe_mode_exec_dir
+
===1) safe_mode_exec_dir===
 
First off, check what the value of the PHP setting
 
First off, check what the value of the PHP setting
 
`safe_mode_exec_dir` is.
 
`safe_mode_exec_dir` is.
Linha 16: Linha 16:
 
   Make sure you can add something in it.
 
   Make sure you can add something in it.
  
# patch includes/Math.php
+
===2) patch includes/Math.php ===
 
It uses backticks ` ` to execute the command, this doesn't
 
It uses backticks ` ` to execute the command, this doesn't
 
work in safe mode, apply the patch named:
 
work in safe mode, apply the patch named:
Linha 26: Linha 26:
 
`safe_mode_include_dir`.
 
`safe_mode_include_dir`.
  
# copy the texvc-wrapper script
+
===3) copy the texvc-wrapper script===
 
Because the data is not escaped, spaces in the latex code
 
Because the data is not escaped, spaces in the latex code
 
confuse texvc. I have written a wrapper that fixes this
 
confuse texvc. I have written a wrapper that fixes this
Linha 36: Linha 36:
 
Don't forget to make the wrapper executable ; )
 
Don't forget to make the wrapper executable ; )
  
# edit your LocalSettings.php
+
===4) edit your LocalSettings.php===
 
 
 
Lastly, edit your LocalSettings.php:
 
Lastly, edit your LocalSettings.php:
#* Of course, enable <math> support
+
* Of course, enable <nowiki><math></nowiki> support
$wgUseTeX = true;
+
$wgUseTeX = true;
#* enable the features provided by the patch
+
* enable the features provided by the patch
define('FIX_TEX_SAFE_MODE', 1);
+
define('FIX_TEX_SAFE_MODE', 1);
#* point the Texvc var to the wrapper script
+
* point the Texvc var to the wrapper script
$wgTexvc           = "{$IP}/math/texvc-wrapper";
+
$wgTexvc   = "{$IP}/math/texvc-wrapper";

Edição das 13h09min de 21 de abril de 2009

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";