r52516 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r52515‎ | r52516 | r52517 >
Date:16:25, 28 June 2009
Author:shinjiman
Status:reverted
Tags:
Comment:
* (bug 14611) Added support showing the version of the SVG image thumbnailing engine. (Supports for ImageMagick, rsvg and Inkscape so far as their version information can be obtained through the command line.)
* Tweaking some version messages for diff3/diff.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -101,6 +101,7 @@
102102 */
103103 static function softwareInformation() {
104104 global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgDiff3, $wgDiff;
 105+ global $wgAllowTitlesInSVG, $wgSVGConverter, $wgSVGConverters, $wgSVGConverterPath;
105106 $dbr = wfGetDB( DB_SLAVE );
106107
107108 // Put the software in an array of form 'name' => 'version'. All messages should
@@ -116,6 +117,7 @@
117118 $swDiff3Info = self::execOutput( $wgDiff3 . ' -v' );
118119 $swDiff3Line = explode("\n",$swDiff3Info ,2);
119120 $swDiff3Ver = $swDiff3Line[0];
 121+ $swDiff3Ver = str_replace( 'diff3 (GNU diffutils) ', '' , $swDiff3Ver);
120122 $software['[http://www.gnu.org/software/diffutils/diffutils.html diff3]'] = $swDiff3Ver;
121123 }
122124
@@ -124,11 +126,12 @@
125127 $swDiffInfo = self::execOutput( $wgDiff . ' -v' );
126128 $swDiffLine = explode("\n",$swDiffInfo ,2);
127129 $swDiffVer = $swDiffLine[0];
 130+ $swDiffVer = str_replace( 'diff (GNU diffutils) ', '' , $swDiffVer);
128131 $software['[http://www.gnu.org/software/diffutils/diffutils.html diff]'] = $swDiffVer;
129132 }
130133
131134 // Look for ImageMagick's version, if did not found, try to find the GD library version
132 - if ( $wgUseImageMagick === true ) {
 135+ if ( $wgUseImageMagick ) {
133136 if ( file_exists( trim( $wgImageMagickConvertCommand, '"' ) ) ) {
134137 $swImageMagickInfo = self::execOutput( $wgImageMagickConvertCommand . ' -version' );
135138 list( $head, $tail ) = explode( 'ImageMagick', $swImageMagickInfo );
@@ -148,6 +151,47 @@
149152 }
150153 }
151154
 155+ // Look for SVG converter and print the version info
 156+ if ( $wgAllowTitlesInSVG ) {
 157+ $swSVGConvName = $wgSVGConverter;
 158+ $haveSVGConvVer = false;
 159+ $pathVar = '$path/';
 160+ $execPath = strtok(strstr($wgSVGConverters[$wgSVGConverter],$pathVar), ' ');
 161+ $execPath = substr_replace($execPath, '', 0, strlen($pathVar));
 162+ $execFullPath = trim($wgSVGConverterPath,'"') . $execPath;
 163+ if (strstr($execFullPath, ' ') != false) {
 164+ $execFullPath = '"'.$execFullPath.'"';
 165+ }
 166+ if ( !strcmp( $wgSVGConverter, 'ImageMagick') ) {
 167+ // Get version info for ImageMagick
 168+ if ( file_exists( trim( $execFullPath, '"' ) ) || file_exists( trim( $execFullPath, '"' ) . '.exe' ) )
 169+ $swSVGConvInfo = self::execOutput( $execFullPath . ' -version' );
 170+ list( $head, $tail ) = explode( 'ImageMagick', $swSVGConvInfo );
 171+ list( $swSVGConvVer ) = explode('http://www.imagemagick.org', $tail );
 172+ $swSVGConvURL = 'http://www.imagemagick.org/';
 173+ $haveSVGConvVer = true;
 174+ } else if (strstr ($execFullPath, 'rsvg') != false) {
 175+ // Get version info for rsvg
 176+ if ( file_exists( trim( $execFullPath, '"' ) ) || file_exists( trim( $execFullPath, '"' ) . '.exe' ) )
 177+ $swSVGConvInfo = self::execOutput( $execFullPath . ' -v' );
 178+ $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
 179+ $swSVGConvVer = $swSVGConvLine[0];
 180+ $swSVGConvURL = 'http://librsvg.sourceforge.net/';
 181+ $haveSVGConvVer = true;
 182+ } else if (strstr ($execFullPath, 'inkscape') != false) {
 183+ // Get version info for Inkscape
 184+ if ( file_exists( trim( $execFullPath, '"' ) ) || file_exists( trim( $execFullPath, '"' ) . '.exe' ) )
 185+ $swSVGConvInfo = self::execOutput( $execFullPath . ' -z -V' );
 186+ $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
 187+ $swSVGConvVer = ltrim( $swSVGConvLine[0], 'Inkscape ' );
 188+ $swSVGConvURL = 'http://www.inkscape.org/';
 189+ $swSVGConvName = ucfirst( $wgSVGConverter );
 190+ $haveSVGConvVer = true;
 191+ }
 192+ if ( $haveSVGConvVer )
 193+ $software["[$swSVGConvURL $swSVGConvName]"] = $swSVGConvVer;
 194+ }
 195+
152196 // Allow a hook to add/remove items
153197 wfRunHooks( 'SoftwareInfo', array( &$software ) );
154198

Follow-up revisions

RevisionCommit summaryAuthorDate
r52522fix regression in r52516 for some distributions which are unable to show the ...shinjiman17:24, 28 June 2009
r52523further fix up for r52522, link to r52516 for CodeReview if having any comments.shinjiman17:29, 28 June 2009
r52525* (bug 14611) Added support showing the version of the Math rendering engine.shinjiman18:42, 28 June 2009
r52792* (bug 14611) Added support showing the version of the web server which it is...shinjiman12:08, 6 July 2009
r53398* (bug 14611) Add a global variable hook to show the extended software inform...shinjiman14:49, 17 July 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52476* (bug 14611) Added support showing the version of the image thumbnailing eng...shinjiman21:58, 26 June 2009
r52486* (bug 14611) Added support showing the version of the diff/diff3 engine.shinjiman10:40, 27 June 2009

Status & tagging log