r54735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54734‎ | r54735 | r54736 >
Date:20:15, 10 August 2009
Author:brion
Status:resolved (Comments)
Tags:
Comment:
Revert Special:Version to known-good state as of r52060, without the ten billion extra callouts that have been added to clutter things up and trigger errors.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/DefaultSettings.php
@@ -2773,8 +2773,8 @@
27742774 * <code>
27752775 * $wgExtensionCredits[$type][] = array(
27762776 * 'name' => 'Example extension',
2777 - * 'version' => 1.9,
2778 - * 'path' => __FILE__,
 2777+ * 'version' => 1.9,
 2778+ * 'path' => __FILE__,
27792779 * 'author' => 'Foo Barstein',
27802780 * 'url' => 'http://wwww.example.com/Example%20Extension/',
27812781 * 'description' => 'An example extension',
@@ -2783,8 +2783,6 @@
27842784 * </code>
27852785 *
27862786 * Where $type is 'specialpage', 'parserhook', 'variable', 'media' or 'other'.
2787 - * Where 'descriptionmsg' can be an array with message key and parameters:
2788 - * 'descriptionmsg' => array( 'exampleextension-desc', param1, param2, ... ),
27892787 */
27902788 $wgExtensionCredits = array();
27912789 /*
Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -13,7 +13,7 @@
1414 private $firstExtOpened = true;
1515
1616 function __construct(){
17 - parent::__construct( 'Version' );
 17+ parent::__construct( 'Version' );
1818 }
1919
2020 /**
@@ -31,7 +31,7 @@
3232 } else {
3333 $wgOut->addHTML( '<div dir="ltr">' );
3434 }
35 - $text =
 35+ $text =
3636 $this->MediaWikiCredits() .
3737 $this->softwareInformation() .
3838 $this->extensionCredits();
@@ -43,36 +43,6 @@
4444 $wgOut->addHTML( '</div>' );
4545 }
4646
47 - /**
48 - * check executive path existence
49 - * @param string command
50 - * @return mixed existsIn
51 - */
52 - static function checkExecPath( $cmd ) {
53 - $existsIn = false;
54 - $pathDirArray = explode( ';' , $_SERVER['PATH'] );
55 - foreach ( $pathDirArray as $pathDir ) {
56 - $pathDir = str_replace('\\', '/', $pathDir);
57 - $pathDir .= '/';
58 - if ( ( file_exists ( $pathDir . '/' . $cmd ) ) || ( file_exists( trim( $pathDir . '/' . $cmd, '"' ) . '.exe' ) ) ) {
59 - $existsIn = $pathDir;
60 - }
61 - }
62 - return $existsIn;
63 - }
64 -
65 - /**
66 - * execuate command for output
67 - * @param string command
68 - * @return string output
69 - */
70 - static function execOutput( $cmd ) {
71 - $out = array( $cmd );
72 - exec( $cmd.' 2>&1', $out );
73 - unset($out[0]);
74 - return implode("\n", $out );
75 - }
76 -
7747 /**#@+
7848 * @private
7949 */
@@ -92,8 +62,7 @@
9363 copyright © 2001-2009 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
9464 Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
9565 Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
96 - Aaron Schulz, Andrew Garrett, Raimond Spekking, Alexandre Emsenhuber,
97 - Siebrand Mazeland, Chad Horohoe and others.
 66+ Aaron Schulz and others.
9867
9968 MediaWiki is free software; you can redistribute it and/or modify
10069 it under the terms of the GNU General Public License as published by
@@ -119,225 +88,16 @@
12089 * @return wiki text showing the third party software versions (apache, php, mysql).
12190 */
12291 static function softwareInformation() {
123 - global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgDiff3, $wgDiff, $wgUseTeX;
124 - global $wgFileExtensions, $wgSVGConverter, $wgSVGConverters, $wgSVGConverterPath;
125 - global $wgUser, $wgSpecialVersionExtended;
12692 $dbr = wfGetDB( DB_SLAVE );
12793
12894 // Put the software in an array of form 'name' => 'version'. All messages should
12995 // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
13096 // can be used
13197 $software = array();
132 -
13398 $software['[http://www.mediawiki.org/ MediaWiki]'] = self::getVersionLinked();
13499 $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
135100 $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
136101
137 - if( $wgSpecialVersionExtended || $wgUser->isAllowed( 'versiondetail' ) ) {
138 - // Get the web server name and its version, if applicable
139 - // Chop off PHP text from the string if it has the text desired
140 - $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
141 - if ( strrpos( $serverSoftware, 'PHP' ) === false ) {
142 - } else {
143 - $serverSoftware = trim( substr( $serverSoftware, 0, strrpos($serverSoftware,'PHP') - 1 ) );
144 - }
145 -
146 - // Get the web server name and its version.
147 - $serverSoftwareLine = explode('/',$serverSoftware);
148 - $serverSoftwareName = $serverSoftwareLine[0];
149 -
150 - // Insert the website of the web server if applicable.
151 - if ( stristr( $serverSoftwareName, 'Apache' ) )
152 - $serverSoftwareURL = 'http://httpd.apache.org/';
153 - else if ( stristr( $serverSoftwareName, 'IIS' ) )
154 - $serverSoftwareURL = 'http://www.microsoft.com/iis/';
155 - else if ( stristr( $serverSoftwareName, 'Cherokee' ) )
156 - $serverSoftwareURL = 'http://www.cherokee-project.com/';
157 - else if ( stristr( $serverSoftwareName, 'lighttpd' ) )
158 - $serverSoftwareURL = 'http://www.lighttpd.net/';
159 - else if ( stristr( $serverSoftwareName, 'Sun' ) )
160 - $serverSoftwareURL = 'http://www.sun.com/software/products/web_srvr/';
161 - else if ( stristr( $serverSoftwareName, 'nginx' ) )
162 - $serverSoftwareURL = 'http://nginx.net/';
163 -
164 - // Get the version of the web server. If does not have one,
165 - // leave it as empty.
166 - if ( $serverSoftwareLine[1] != '' ) {
167 - $serverSoftwareVersion = $serverSoftwareLine[1];
168 - } else {
169 - $serverSoftwareVersion = '';
170 - }
171 -
172 - if ( isset( $serverSoftwareURL ) )
173 - $software["[$serverSoftwareURL $serverSoftwareName]"] = $serverSoftwareVersion;
174 - else
175 - $software[$serverSoftwareName] = $serverSoftwareVersion;
176 -
177 - // Version information for diff3
178 - if ( file_exists( trim( $wgDiff3, '"' ) ) ) {
179 - $swDiff3Info = self::execOutput( $wgDiff3 . ' -v' );
180 - $swDiff3Line = explode("\n",$swDiff3Info ,2);
181 - $swDiff3Ver = $swDiff3Line[0];
182 - $swDiff3Ver = str_replace( 'diff3 (GNU diffutils) ', '' , $swDiff3Ver);
183 - $software['[http://www.gnu.org/software/diffutils/diffutils.html diff3]'] = $swDiff3Ver;
184 - }
185 -
186 - // Version information for diff
187 - if ( file_exists( trim( $wgDiff, '"' ) ) ) {
188 - $swDiffInfo = self::execOutput( $wgDiff . ' -v' );
189 - $swDiffLine = explode("\n",$swDiffInfo ,2);
190 - $swDiffVer = $swDiffLine[0];
191 - $swDiffVer = str_replace( 'diff (GNU diffutils) ', '' , $swDiffVer);
192 - $software['[http://www.gnu.org/software/diffutils/diffutils.html diff]'] = $swDiffVer;
193 - }
194 -
195 - // Look for ImageMagick's version, if did not found, try to find the GD library version
196 - if ( $wgUseImageMagick ) {
197 - if ( file_exists( trim( $wgImageMagickConvertCommand, '"' ) ) ) {
198 - $swImageMagickInfo = self::execOutput( $wgImageMagickConvertCommand . ' -version' );
199 - list( $head, $tail ) = explode( 'ImageMagick', $swImageMagickInfo );
200 - list( $swImageMagickVer ) = explode('http://www.imagemagick.org', $tail );
201 - $software['[http://www.imagemagick.org/ ImageMagick]'] = $swImageMagickVer;
202 - }
203 - } else {
204 - if( function_exists( 'gd_info' ) ) {
205 - $gdInfo = gd_info();
206 - if ( strstr( $gdInfo['GD Version'], 'bundled' ) != false ) {
207 - $gd_URL = 'http://www.php.net/gd';
208 - } else {
209 - $gd_URL = 'http://www.libgd.org';
210 - }
211 - $software['[' . $gd_URL . ' GD library]'] = $gdInfo['GD Version'];
212 - }
213 - }
214 -
215 - // Look for SVG converter and print the version info
216 - if ( in_array( 'svg', $wgFileExtensions ) ) {
217 - $swSVGConvName = $wgSVGConverter;
218 - $swSVGConvInfo = '';
219 - $haveSVGConvVer = false;
220 - $pathVar = '$path/';
221 - $binPath = '/usr/bin/';
222 - $execPath = strtok(strstr($wgSVGConverters[$wgSVGConverter],$pathVar), ' ');
223 - $execPath = substr_replace($execPath, '', 0, strlen($pathVar));
224 - $execFullPath = trim($wgSVGConverterPath,'"') . $execPath;
225 - $execBinPath = $binPath . $execPath;
226 - $execPathVal = self::checkExecPath( $execPath );
227 - if (strstr($execFullPath, ' ') != false) {
228 - $execFullPath = '"' . $execFullPath . '"';
229 - }
230 - if ( !strcmp( $wgSVGConverter, 'ImageMagick') ) {
231 - // Get version info for ImageMagick
232 - if ( file_exists( $execBinPath ) )
233 - $swSVGConvInfo = self::execOutput( $execBinPath . ' -version' );
234 - else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
235 - $swSVGConvInfo = self::execOutput( $execFullPath . ' -version' );
236 - else if ( $execPathVal != false )
237 - $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -version' );
238 - list( $head, $tail ) = explode( 'ImageMagick', $swSVGConvInfo );
239 - list( $swSVGConvVer ) = explode('http://www.imagemagick.org', $tail );
240 - $swSVGConvURL = 'http://www.imagemagick.org/';
241 - $haveSVGConvVer = true;
242 - } else if ( strstr ($execFullPath, 'rsvg') != false ) {
243 - // Get version info for rsvg
244 - if ( file_exists( $execBinPath ) )
245 - $swSVGConvInfo = self::execOutput( $execBinPath . ' -v' );
246 - else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
247 - $swSVGConvInfo = self::execOutput( $execFullPath . ' -v' );
248 - else if ( $execPathVal != false )
249 - $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -v' );
250 - $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
251 - $swSVGConvVer = $swSVGConvLine[0];
252 - $swSVGConvURL = 'http://librsvg.sourceforge.net/';
253 - $haveSVGConvVer = true;
254 - } else if ( strstr ($execFullPath, 'inkscape') != false ) {
255 - // Get version info for Inkscape
256 - if ( file_exists( $execBinPath ) )
257 - $swSVGConvInfo = self::execOutput( $execBinPath . ' -z -V' );
258 - else if ( file_exists( trim( $execFullPath, '"' ) ) || ( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
259 - $swSVGConvInfo = self::execOutput( $execFullPath . ' -z -V' );
260 - else if ( $execPathVal != false )
261 - $swSVGConvInfo = self::execOutput( $execPathVal . $execPath . ' -z -V' );
262 - $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
263 - $swSVGConvVer = ltrim( $swSVGConvLine[0], 'Inkscape ' );
264 - $swSVGConvURL = 'http://www.inkscape.org/';
265 - $swSVGConvName = ucfirst( $wgSVGConverter );
266 - $haveSVGConvVer = true;
267 - }
268 - if ( $haveSVGConvVer )
269 - $software["[$swSVGConvURL $swSVGConvName]"] = $swSVGConvVer;
270 - }
271 -
272 - // Look for TeX support and print the software version info
273 - if ( $wgUseTeX ) {
274 - $binPath = '/usr/bin/';
275 - $swMathName = Array(
276 - 'ocaml' => 'OCaml',
277 - 'gs' => 'Ghostscript',
278 - 'dvips' => 'Dvips',
279 - 'latex' => 'LaTeX',
280 - 'imagemagick' => 'ImageMagick',
281 - );
282 - $swMathURL = Array(
283 - 'ocaml' => 'http://caml.inria.fr/',
284 - 'gs' => 'http://www.ghostscript.com/',
285 - 'dvips' => 'http://www.radicaleye.com/dvips.html',
286 - 'latex' => 'http://www.latex-project.org/',
287 - 'imagemagick' => 'http://www.imagemagick.org/',
288 - );
289 - $swMathExec = Array(
290 - 'ocaml' => 'ocamlc',
291 - 'gs' => 'gs',
292 - 'dvips' => 'dvips',
293 - 'latex' => 'latex',
294 - 'imagemagick' => 'convert',
295 - );
296 - $swMathParam = Array(
297 - 'ocaml' => '-version',
298 - 'gs' => '-v',
299 - 'dvips' => '-v',
300 - 'latex' => '-v',
301 - 'imagemagick' => '-version',
302 - );
303 - foreach ( $swMathExec as $swMath => $swMathCmd ) {
304 - $wBinPath = '';
305 - if ( file_exists( $binPath . 'whereis' ) ) {
306 - $swWhereIsInfo = self::execOutput( $binPath . 'whereis -b ' . $swMathCmd );
307 - $swWhereIsLine = explode( "\n", $swWhereIsInfo, 2);
308 - $swWhereIsFirstLine = $swWhereIsLine[0];
309 - $swWhereIsBinPath = explode( ' ', $swWhereIsFirstLine, 3);
310 - if ( count( $swWhereIsBinPath ) > 1 )
311 - $wBinPath = dirname( $swWhereIsBinPath[1] );
312 - } else {
313 - $swPathLine = explode( ';', $_SERVER['PATH'] );
314 - $swPathFound = false;
315 - foreach( $swPathLine as $swPathDir ) {
316 - if ( file_exists( $swPathDir . '/' . $swMathCmd . '.exe' ) && ($swPathFound === false) ) {
317 - $wBinPath = $swPathDir . '/';
318 - $swPathFound = true;
319 - }
320 - }
321 - }
322 - if ( file_exists( $binPath . $swMathCmd ) || file_exists( $wBinPath . $swMathCmd ) ) {
323 - $swMathInfo = self::execOutput( $swMathCmd . ' ' . $swMathParam[$swMath] );
324 - $swMathLine = explode( "\n", $swMathInfo, 2);
325 - $swMathVerInfo = $swMathLine[0];
326 - if ( !strcmp( $swMath, 'gs' ) )
327 - $swMathVerInfo = str_replace( 'GPL Ghostscript ', '', $swMathVerInfo );
328 - else if ( !strcmp( $swMath, 'dvips' ) ) {
329 - $swMathVerParts = explode( ' ' , $swMathVerInfo );
330 - $swMathVerInfo = $swMathVerParts[3];
331 - } else if ( !strcmp( $swMath, 'imagemagick' ) ) {
332 - list( $head, $tail ) = explode( 'ImageMagick', $swMathVerInfo );
333 - list( $swMathVerInfo ) = explode('http://www.imagemagick.org', $tail );
334 - }
335 - $swMathVer[$swMath] = trim( $swMathVerInfo );
336 - $software["[$swMathURL[$swMath] $swMathName[$swMath]]"] = $swMathVer[$swMath];
337 - }
338 - }
339 - }
340 - }
341 -
342102 // Allow a hook to add/remove items
343103 wfRunHooks( 'SoftwareInfo', array( &$software ) );
344104
@@ -352,7 +112,7 @@
353113 <td>" . $name . "</td>
354114 <td>" . $version . "</td>
355115 </tr>\n";
356 - }
 116+ }
357117 return $out . Xml::closeElement( 'table' );
358118 }
359119
@@ -376,7 +136,7 @@
377137 wfProfileOut( __METHOD__ );
378138 return $version;
379139 }
380 -
 140+
381141 /**
382142 * Return a string of the MediaWiki version with a link to SVN revision if
383143 * available
@@ -447,7 +207,7 @@
448208 isset ( $extension['author'] ) ? $extension['author'] : '',
449209 isset ( $extension['url'] ) ? $extension['url'] : null,
450210 isset ( $extension['description'] ) ? $extension['description'] : '',
451 - isset ( $extension['descriptionmsg'] ) ? $extension['descriptionmsg'] : null
 211+ isset ( $extension['descriptionmsg'] ) ? $extension['descriptionmsg'] : ''
452212 );
453213 }
454214 }
@@ -493,20 +253,13 @@
494254 function formatCredits( $name, $version = null, $subVersion = null, $subVersionCo = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
495255 $haveSubversion = $subVersion;
496256 $extension = isset( $url ) ? "[$url $name]" : $name;
497 - $version = isset( $version ) ? '<span class="mw-version-ext-version">' . wfMsg( 'version-version', $version ) . '</span>' : '';
 257+ $version = isset( $version ) ? wfMsg( 'version-version', $version ) : '';
498258 $subVersion = isset( $subVersion ) ? wfMsg( 'version-svn-revision', $subVersion, $subVersionCo ) : '';
499259 $subVersion = isset( $subVersionURL ) ? "[$subVersionURL $subVersion]" : $subVersion;
500260
501261 # Look for a localized description
502262 if( isset( $descriptionMsg ) ) {
503 - if( is_array( $descriptionMsg ) ) {
504 - $descriptionMsgKey = $descriptionMsg[0]; // Get the message key
505 - array_shift( $descriptionMsg ); // Shift out the message key to get the parameters only
506 - array_map( "htmlspecialchars", $descriptionMsg ); // For sanity
507 - $msg = wfMsg( $descriptionMsgKey, $descriptionMsg );
508 - } else {
509 - $msg = wfMsg( $descriptionMsg );
510 - }
 263+ $msg = wfMsg( $descriptionMsg );
511264 if ( !wfEmptyMsg( $descriptionMsg, $msg ) && $msg != '' ) {
512265 $description = $msg;
513266 }
@@ -616,7 +369,7 @@
617370 } else {
618371 if( is_object( $list[0] ) )
619372 $class = get_class( $list[0] );
620 - else
 373+ else
621374 $class = $list[0];
622375 return "($class, {$list[1]})";
623376 }
@@ -631,7 +384,7 @@
632385 * @param Boolean $extension optional to check the path whether is from
633386 * Wikimedia SVN server or not
634387 * @param Boolean $relPath optional to get the end part of the checkout path
635 - * @return mixed revision number as int, end part of the checkout path,
 388+ * @return mixed revision number as int, end part of the checkout path,
636389 * or false if not a SVN checkout
637390 */
638391 public static function getSvnRevision( $dir, $coRev = false, $extension = false, $relPath = false) {
Index: trunk/phase3/RELEASE-NOTES
@@ -131,9 +131,6 @@
132132 stripped from them.
133133 * Added a PHP port of CDB (constant database), for improved local caching when
134134 the DBA extension is not available.
135 -* (bug 14611) Added support showing the version of the web server, image
136 - thumbnailing engine, diff/diff3 engine and TeX engine, enabled for sysops
137 - by default.
138135 * Introduced a new system for localisation caching. The system is based around
139136 fast fetches of individual messages, minimising memory overhead and startup
140137 time in the typical case. The database backend will be used by default, but
@@ -176,7 +173,6 @@
177174 extension version in Special:Version
178175 * (bug 20014) Added CSS class "mw-listgrouprights-right-name" is wrapped on the
179176 right name in Special:ListGroupRights
180 -* The description message in $wgExtensionCredits can be an array with parameters
181177 * (bug 12920) New CoreParserFunction {{nse:...}} as an url-friendly equivalent
182178 to {{ns:...}}
183179 * (bug 16322) Allow maintenance scripts to accept DB user/pass over input or params

Follow-up revisions

RevisionCommit summaryAuthorDate
r54772Recommit r54081 after general revert r54735: The description message in $wgEx...raymond07:08, 11 August 2009
r54997Recommit r52524 (ialex) after general revert r54735: '' => null when 'descrip...raymond08:12, 14 August 2009
r54999Recommit r53268 (simetrical) after general revert r54735: Fix bug, werdna not...raymond08:16, 14 August 2009
r55000Recommit r54069 (shinjiman) after general revert r54735: * (bug 20013) Added ...raymond08:19, 14 August 2009
r59001Removed $wgSpecialVersionExtended, not used anymore since r54735ialex11:47, 13 November 2009
r60394RELEASE-NOTES cleanup:...ialex18:35, 25 December 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r52060* Add class=wikitable to some tables on specialpages for better styling consi...raymond18:05, 17 June 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   02:13, 19 August 2009

The good bits appear to have been reapplied. Thanks guys!

Status & tagging log