From b77cdc86c9d9bdfa989cc073039332c3212e5766 Mon Sep 17 00:00:00 2001 From: Shinjiman Date: Sun, 28 Jun 2009 18:42:55 +0000 Subject: [PATCH] * (bug 14611) Added support showing the version of the Math rendering engine. --- RELEASE-NOTES | 2 +- includes/specials/SpecialVersion.php | 53 +++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 727fd8f4eb..70664737b9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -101,7 +101,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added a PHP port of CDB (constant database), for improved local caching when the DBA extension is not available. * (bug 14611) Added support showing the version of the image thumbnailing - engine and diff/diff3 engine. + engine, diff/diff3 engine and TeX engine. * Introduced a new system for localisation caching. The system is based around fast fetches of individual messages, minimising memory overhead and startup time in the typical case. The database backend will be used by default, but diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index a626a6903c..e837985c65 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -100,7 +100,7 @@ class SpecialVersion extends SpecialPage { * @return wiki text showing the third party software versions (apache, php, mysql). */ static function softwareInformation() { - global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgDiff3, $wgDiff; + global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgDiff3, $wgDiff, $wgUseTeX; global $wgAllowTitlesInSVG, $wgSVGConverter, $wgSVGConverters, $wgSVGConverterPath; $dbr = wfGetDB( DB_SLAVE ); @@ -200,6 +200,57 @@ class SpecialVersion extends SpecialPage { $software["[$swSVGConvURL $swSVGConvName]"] = $swSVGConvVer; } + // Look for TeX support and print the software version info + if ( $wgUseTeX ) { + $binPath = '/usr/bin/'; + $swMathName = Array( + 'ocaml' => 'OCaml', + 'gs' => 'Ghostscript', + 'dvips' => 'Dvips', + 'latex' => 'LaTeX', + 'imagemagick' => 'ImageMagick', + ); + $swMathNURL = Array( + 'ocaml' => 'http://caml.inria.fr/', + 'gs' => 'http://www.ghostscript.com/', + 'dvips' => 'http://www.radicaleye.com/dvips.html', + 'latex' => 'http://www.latex-project.org/', + 'imagemagick' => 'http://www.imagemagick.org/', + ); + $swMathExec = Array( + 'ocaml' => 'ocamlc', + 'gs' => 'gs', + 'dvips' => 'dvips', + 'latex' => 'latex', + 'imagemagick' => 'convert', + ); + $swMathParam = Array( + 'ocaml' => '-version', + 'gs' => '-v', + 'dvips' => '-v', + 'latex' => '-v', + 'imagemagick' => '-version', + ); + foreach ( $swMathExec as $swMath => $swMathCmd ) { + if ( file_exists( $binPath . $swMathCmd ) ) { + $swMathInfo = self::execOutput( $binPath . $swMathCmd . ' ' . $swMathParam[$swMath] ); + $swMathLine = explode("\n",$swMathInfo ,2); + $swMathVerInfo = $swMathLine[0]; + if ( !strcmp( $swMath, 'gs' ) ) + $swMathVerInfo = str_replace( 'GPL Ghostscript ', '', $swMathVerInfo ); + else if ( !strcmp( $swMath, 'dvips' ) ) { + $swMathVerParts = explode( ' ' , $swMathVerInfo ); + $swMathVerInfo = $swMathVerParts[3]; + } else if ( !strcmp( $swMath, 'imagemagick' ) ) { + list( $head, $tail ) = explode( 'ImageMagick', $swMathVerInfo ); + list( $swMathVerInfo ) = explode('http://www.imagemagick.org', $tail ); + } + $swMathVer[$swMath] = $swMathVerInfo; + $software["[$swMathURL $swMathName]"] = $swMathVer[$swMath]; + } + } + } + // Allow a hook to add/remove items wfRunHooks( 'SoftwareInfo', array( &$software ) ); -- 2.20.1