* (bug 14611) Added support showing the version of the image thumbnailing engine.
authorShinjiman <shinjiman@users.mediawiki.org>
Fri, 26 Jun 2009 21:58:34 +0000 (21:58 +0000)
committerShinjiman <shinjiman@users.mediawiki.org>
Fri, 26 Jun 2009 21:58:34 +0000 (21:58 +0000)
RELEASE-NOTES
includes/specials/SpecialVersion.php

index 06fdbc1..293e4ad 100644 (file)
@@ -91,7 +91,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   stripped from them.
 * 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.
 
 === Bug fixes in 1.16 ===
 
index 62cbac8..4a12d57 100644 (file)
@@ -43,6 +43,18 @@ class SpecialVersion extends SpecialPage {
                $wgOut->addHTML( '</div>' );
        }
 
+       /**
+        * execuate command for output
+        * @param string command
+        * @return string output
+        */
+       function execOutput( $cmd ) {
+               $out = array( $cmd );
+               exec( $cmd.' 2>&1', $out );
+               unset($out[0]);
+               return implode("\n", $out );
+       }
+
        /**#@+
         * @private
         */
@@ -88,6 +100,7 @@ class SpecialVersion extends SpecialPage {
         * @return wiki text showing the third party software versions (apache, php, mysql).
         */
        static function softwareInformation() {
+               global $wgUseImageMagick, $wgImageMagickConvertCommand;
                $dbr = wfGetDB( DB_SLAVE );
 
                // Put the software in an array of form 'name' => 'version'. All messages should
@@ -98,6 +111,27 @@ class SpecialVersion extends SpecialPage {
                $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
                $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
 
+               // Look for ImageMagick's version, if did not found, try to find the GD library version
+               if ( $wgUseImageMagick === true ) {
+                       if ( file_exists( $wgImageMagickConvertCommand ) ) {
+                               $swImageMagickInfo = self::execOutput( $wgImageMagickConvertCommand . ' -version' );
+                               list( $head, $tail ) = explode( 'ImageMagick', $swImageMagickInfo );
+                               list( $swImageMagickVer ) = explode('http://www.imagemagick.org', $tail );
+                               $software['[http://www.imagemagick.org/ ImageMagick]'] = $swImageMagickVer;
+                       }
+               } else {
+                       if( function_exists( 'gd_info' ) ) {
+                               $gdInfo = gd_info();
+                               if ( strstr( $gdInfo['GD Version'], 'bundled' ) !== '' ) {
+                                       $gd_URL = 'http://www.php.net/gd';
+                               }
+                               else {
+                                       $gd_URL = 'http://www.libgd.org';
+                               }
+                               $software['[' . $gd_URL . ' GD library]'] = $gdInfo['GD Version'];
+                       }
+               }
+
                // Allow a hook to add/remove items
                wfRunHooks( 'SoftwareInfo', array( &$software ) );