* (bug 14611) Added support showing the version of the web server which it is current...
authorShinjiman <shinjiman@users.mediawiki.org>
Mon, 6 Jul 2009 12:08:42 +0000 (12:08 +0000)
committerShinjiman <shinjiman@users.mediawiki.org>
Mon, 6 Jul 2009 12:08:42 +0000 (12:08 +0000)
RELEASE-NOTES
includes/specials/SpecialVersion.php

index 18088da..619738d 100644 (file)
@@ -102,8 +102,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, diff/diff3 engine and TeX engine.
+* (bug 14611) Added support showing the version of the web server, image 
+  thumbnailing 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 
index 9c67483..da0ec1c 100644 (file)
@@ -104,11 +104,47 @@ class SpecialVersion extends SpecialPage {
                global $wgAllowTitlesInSVG, $wgSVGConverter, $wgSVGConverters, $wgSVGConverterPath;
                $dbr = wfGetDB( DB_SLAVE );
 
+               // Get the web server name and its version, if applicable
+               // Chop off PHP text from the string if it has the text desired
+               $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
+               if ( strrpos( $serverSoftware, 'PHP' ) === false ) {
+               } else {
+                       $serverSoftware = trim( substr( $serverSoftware, 0, strrpos($serverSoftware,'PHP') - 1 ) );
+               }
+
+               // Get the web server name and its version.
+               $serverSoftwareLine = explode('/',$serverSoftware);
+               $serverSoftwareName = $serverSoftwareLine[0];
+
+               // Insert the website of the web server if applicable.
+               if ( stristr( $serverSoftwareName, 'Apache' ) )
+                       $serverSoftwareURL = 'http://httpd.apache.org/';
+               else if ( stristr( $serverSoftwareName, 'IIS' ) )
+                       $serverSoftwareURL = 'http://www.microsoft.com/iis/';
+               else if ( stristr( $serverSoftwareName, 'Cherokee' ) )
+                       $serverSoftwareURL = 'http://www.cherokee-project.com/';
+               else if ( stristr( $serverSoftwareName, 'lighttpd' ) )
+                       $serverSoftwareURL = 'http://www.lighttpd.net/';
+               else if ( stristr( $serverSoftwareName, 'Sun' ) )
+                       $serverSoftwareURL = 'http://www.sun.com/software/products/web_srvr/';
+
+               // Get the version of the web server. If does not have one,
+               // leave it as empty.
+               if ( $serverSoftwareLine[1] != '' ) {
+                       $serverSoftwareVersion = $serverSoftwareLine[1];
+               } else {
+                       $serverSoftwareVersion = '';
+               }
+
                // Put the software in an array of form 'name' => 'version'. All messages should
                // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
                // can be used
                $software = array();
                $software['[http://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
+               if ( isset( $serverSoftwareURL ) )
+                       $software["[$serverSoftwareURL $serverSoftwareName]"] = $serverSoftwareVersion;
+               else
+                       $software[$serverSoftwareName] = $serverSoftwareVersion;
                $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
                $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();