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

De WikiLICC
Ir para: navegação, pesquisa
(Nova página: Mediawiki <math> support with PHP safe_mode =========================================== Author: Mattias Guns <tias@ulyssis.org> http://xylofaan.ulyssis.org/patch/mediawiki/math_safe_m...)
 
Linha 1: Linha 1:
Mediawiki <math> support with PHP safe_mode
+
==Mediawiki <nowiki><math></nowiki> support with PHP safe_mode==
===========================================
 
  
 
Author: Mattias Guns <tias@ulyssis.org>
 
Author: Mattias Guns <tias@ulyssis.org>
 
http://xylofaan.ulyssis.org/patch/mediawiki/math_safe_mode/
 
http://xylofaan.ulyssis.org/patch/mediawiki/math_safe_mode/
  
These are the steps I had to take to get <math> support
+
These are the steps I had to take to get <nowiki><math></nowiki> support working an a box that uses PHP safe_mode.
working an a box that uses PHP safe_mode.
 
  
1) safe_mode_exec_dir
+
# 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 19: Linha 16:
 
   Make sure you can add something in it.
 
   Make sure you can add something in it.
  
2) patch includes/Math.php
+
# 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 30: Linha 26:
 
`safe_mode_include_dir`.
 
`safe_mode_include_dir`.
  
3) copy the texvc-wrapper script
+
# 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 41: Linha 36:
 
Don't forget to make the wrapper executable ; )
 
Don't forget to make the wrapper executable ; )
  
4) edit your LocalSettings.php
+
# edit your LocalSettings.php
------------------------------
+
 
 
Lastly, edit your LocalSettings.php:
 
Lastly, edit your LocalSettings.php:
# Of course, enable <math> support
+
#* Of course, enable <math> 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 13h06min 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.
  1. 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`.

  1. 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 ; )

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