4 * Give information about the version of MediaWiki, PHP, the DB and extensions
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
12 class SpecialVersion
extends SpecialPage
{
13 private $firstExtOpened = true;
15 function __construct(){
16 parent
::__construct( 'Version' );
22 function execute( $par ) {
23 global $wgOut, $wgMessageCache, $wgSpecialVersionShowHooks, $wgContLang;
24 $wgMessageCache->loadAllMessages();
27 $this->outputHeader();
29 if( $wgContLang->isRTL() ) {
30 $wgOut->addHTML( '<div dir="rtl">' );
32 $wgOut->addHTML( '<div dir="ltr">' );
35 $this->MediaWikiCredits() .
36 $this->softwareInformation() .
37 $this->extensionCredits();
38 if ( $wgSpecialVersionShowHooks ) {
39 $text .= $this->wgHooks();
41 $wgOut->addWikiText( $text );
42 $wgOut->addHTML( $this->IPInfo() );
43 $wgOut->addHTML( '</div>' );
47 * execuate command for output
48 * @param string command
49 * @return string output
51 static function execOutput( $cmd ) {
53 exec( $cmd.' 2>&1', $out );
55 return implode("\n", $out );
63 * @return wiki text showing the license information
65 static function MediaWikiCredits() {
68 $ret = Xml
::element( 'h2', array( 'id' => 'mw-version-license' ), wfMsg( 'version-license' ) );
70 // This text is always left-to-right.
71 $ret .= '<div dir="ltr">';
73 This wiki is powered by '''[http://www.mediawiki.org/ MediaWiki]''',
74 copyright © 2001-2009 Magnus Manske, Brion Vibber, Lee Daniel Crocker,
75 Tim Starling, Erik Möller, Gabriel Wicke, Ævar Arnfjörð Bjarmason,
76 Niklas Laxström, Domas Mituzas, Rob Church, Yuri Astrakhan, Aryeh Gregor,
77 Aaron Schulz, Andrew Garrett, Raimond Spekking, Alexandre Emsenhuber,
78 Siebrand Mazeland and others.
80 MediaWiki is free software; you can redistribute it and/or modify
81 it under the terms of the GNU General Public License as published by
82 the Free Software Foundation; either version 2 of the License, or
83 (at your option) any later version.
85 MediaWiki is distributed in the hope that it will be useful,
86 but WITHOUT ANY WARRANTY; without even the implied warranty of
87 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
88 GNU General Public License for more details.
90 You should have received [{{SERVER}}{{SCRIPTPATH}}/COPYING a copy of the GNU General Public License]
91 along with this program; if not, write to the Free Software
92 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
93 or [http://www.gnu.org/licenses/old-licenses/gpl-2.0.html read it online].
97 return str_replace( "\t\t", '', $ret ) . "\n";
101 * @return wiki text showing the third party software versions (apache, php, mysql).
103 static function softwareInformation() {
104 global $wgUseImageMagick, $wgImageMagickConvertCommand, $wgDiff3, $wgDiff, $wgUseTeX;
105 global $wgFileExtensions, $wgSVGConverter, $wgSVGConverters, $wgSVGConverterPath;
106 global $wgUser, $wgSpecialVersionExtended;
107 $dbr = wfGetDB( DB_SLAVE
);
109 // Put the software in an array of form 'name' => 'version'. All messages should
110 // be loaded here, so feel free to use wfMsg*() in the 'name'. Raw HTML or wikimarkup
114 $software['[http://www.mediawiki.org/ MediaWiki]'] = self
::getVersionLinked();
115 $software['[http://www.php.net/ PHP]'] = phpversion() . " (" . php_sapi_name() . ")";
116 $software[$dbr->getSoftwareLink()] = $dbr->getServerVersion();
118 if( $wgSpecialVersionExtended ||
$wgUser->isAllowed( 'versiondetail' ) ) {
119 // Get the web server name and its version, if applicable
120 // Chop off PHP text from the string if it has the text desired
121 $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
122 if ( strrpos( $serverSoftware, 'PHP' ) === false ) {
124 $serverSoftware = trim( substr( $serverSoftware, 0, strrpos($serverSoftware,'PHP') - 1 ) );
127 // Get the web server name and its version.
128 $serverSoftwareLine = explode('/',$serverSoftware);
129 $serverSoftwareName = $serverSoftwareLine[0];
131 // Insert the website of the web server if applicable.
132 if ( stristr( $serverSoftwareName, 'Apache' ) )
133 $serverSoftwareURL = 'http://httpd.apache.org/';
134 else if ( stristr( $serverSoftwareName, 'IIS' ) )
135 $serverSoftwareURL = 'http://www.microsoft.com/iis/';
136 else if ( stristr( $serverSoftwareName, 'Cherokee' ) )
137 $serverSoftwareURL = 'http://www.cherokee-project.com/';
138 else if ( stristr( $serverSoftwareName, 'lighttpd' ) )
139 $serverSoftwareURL = 'http://www.lighttpd.net/';
140 else if ( stristr( $serverSoftwareName, 'Sun' ) )
141 $serverSoftwareURL = 'http://www.sun.com/software/products/web_srvr/';
142 else if ( stristr( $serverSoftwareName, 'nginx' ) )
143 $serverSoftwareURL = 'http://nginx.net/';
145 // Get the version of the web server. If does not have one,
146 // leave it as empty.
147 if ( $serverSoftwareLine[1] != '' ) {
148 $serverSoftwareVersion = $serverSoftwareLine[1];
150 $serverSoftwareVersion = '';
153 if ( isset( $serverSoftwareURL ) )
154 $software["[$serverSoftwareURL $serverSoftwareName]"] = $serverSoftwareVersion;
156 $software[$serverSoftwareName] = $serverSoftwareVersion;
158 // Version information for diff3
159 if ( file_exists( trim( $wgDiff3, '"' ) ) ) {
160 $swDiff3Info = self
::execOutput( $wgDiff3 . ' -v' );
161 $swDiff3Line = explode("\n",$swDiff3Info ,2);
162 $swDiff3Ver = $swDiff3Line[0];
163 $swDiff3Ver = str_replace( 'diff3 (GNU diffutils) ', '' , $swDiff3Ver);
164 $software['[http://www.gnu.org/software/diffutils/diffutils.html diff3]'] = $swDiff3Ver;
167 // Version information for diff
168 if ( file_exists( trim( $wgDiff, '"' ) ) ) {
169 $swDiffInfo = self
::execOutput( $wgDiff . ' -v' );
170 $swDiffLine = explode("\n",$swDiffInfo ,2);
171 $swDiffVer = $swDiffLine[0];
172 $swDiffVer = str_replace( 'diff (GNU diffutils) ', '' , $swDiffVer);
173 $software['[http://www.gnu.org/software/diffutils/diffutils.html diff]'] = $swDiffVer;
176 // Look for ImageMagick's version, if did not found, try to find the GD library version
177 if ( $wgUseImageMagick ) {
178 if ( file_exists( trim( $wgImageMagickConvertCommand, '"' ) ) ) {
179 $swImageMagickInfo = self
::execOutput( $wgImageMagickConvertCommand . ' -version' );
180 list( $head, $tail ) = explode( 'ImageMagick', $swImageMagickInfo );
181 list( $swImageMagickVer ) = explode('http://www.imagemagick.org', $tail );
182 $software['[http://www.imagemagick.org/ ImageMagick]'] = $swImageMagickVer;
185 if( function_exists( 'gd_info' ) ) {
187 if ( strstr( $gdInfo['GD Version'], 'bundled' ) != false ) {
188 $gd_URL = 'http://www.php.net/gd';
190 $gd_URL = 'http://www.libgd.org';
192 $software['[' . $gd_URL . ' GD library]'] = $gdInfo['GD Version'];
196 // Look for SVG converter and print the version info
197 if ( in_array( 'svg', $wgFileExtensions ) ) {
198 $swSVGConvName = $wgSVGConverter;
199 $haveSVGConvVer = false;
201 $binPath = '/usr/bin/';
202 $execPath = strtok(strstr($wgSVGConverters[$wgSVGConverter],$pathVar), ' ');
203 $execPath = substr_replace($execPath, '', 0, strlen($pathVar));
204 $execFullPath = trim($wgSVGConverterPath,'"') . $execPath;
205 $execBinPath = $binPath . $execPath;
206 if (strstr($execFullPath, ' ') != false) {
207 $execFullPath = '"' . $execFullPath . '"';
209 if ( !strcmp( $wgSVGConverter, 'ImageMagick') ) {
210 // Get version info for ImageMagick
211 if ( file_exists( $execBinPath ) )
212 $swSVGConvInfo = self
::execOutput( $execBinPath . ' -version' );
213 else if ( file_exists( trim( $execFullPath, '"' ) ) ||
( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
214 $swSVGConvInfo = self
::execOutput( $execFullPath . ' -version' );
215 list( $head, $tail ) = explode( 'ImageMagick', $swSVGConvInfo );
216 list( $swSVGConvVer ) = explode('http://www.imagemagick.org', $tail );
217 $swSVGConvURL = 'http://www.imagemagick.org/';
218 $haveSVGConvVer = true;
219 } else if ( strstr ($execFullPath, 'rsvg') != false ) {
220 // Get version info for rsvg
221 if ( file_exists( $execBinPath ) )
222 $swSVGConvInfo = self
::execOutput( $execBinPath . ' -v' );
223 else if ( file_exists( trim( $execFullPath, '"' ) ) ||
( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
224 $swSVGConvInfo = self
::execOutput( $execFullPath . ' -v' );
225 $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
226 $swSVGConvVer = $swSVGConvLine[0];
227 $swSVGConvURL = 'http://librsvg.sourceforge.net/';
228 $haveSVGConvVer = true;
229 } else if ( strstr ($execFullPath, 'inkscape') != false ) {
230 // Get version info for Inkscape
231 if ( file_exists( $execBinPath ) )
232 $swSVGConvInfo = self
::execOutput( $execBinPath . ' -z -V' );
233 else if ( file_exists( trim( $execFullPath, '"' ) ) ||
( file_exists( trim( $execFullPath, '"' ) . '.exe' ) ) )
234 $swSVGConvInfo = self
::execOutput( $execFullPath . ' -z -V' );
235 $swSVGConvLine = explode("\n",$swSVGConvInfo ,2);
236 $swSVGConvVer = ltrim( $swSVGConvLine[0], 'Inkscape ' );
237 $swSVGConvURL = 'http://www.inkscape.org/';
238 $swSVGConvName = ucfirst( $wgSVGConverter );
239 $haveSVGConvVer = true;
241 if ( $haveSVGConvVer )
242 $software["[$swSVGConvURL $swSVGConvName]"] = $swSVGConvVer;
245 // Look for TeX support and print the software version info
247 $binPath = '/usr/bin/';
250 'gs' => 'Ghostscript',
253 'imagemagick' => 'ImageMagick',
256 'ocaml' => 'http://caml.inria.fr/',
257 'gs' => 'http://www.ghostscript.com/',
258 'dvips' => 'http://www.radicaleye.com/dvips.html',
259 'latex' => 'http://www.latex-project.org/',
260 'imagemagick' => 'http://www.imagemagick.org/',
267 'imagemagick' => 'convert',
269 $swMathParam = Array(
270 'ocaml' => '-version',
274 'imagemagick' => '-version',
276 foreach ( $swMathExec as $swMath => $swMathCmd ) {
278 if ( file_exists( $binPath . 'whereis' ) ) {
279 $swWhereIsInfo = self
::execOutput( $binPath . 'whereis -b ' . $swMathCmd );
280 $swWhereIsLine = explode( "\n", $swWhereIsInfo, 2);
281 $swWhereIsFirstLine = $swWhereIsLine[0];
282 $swWhereIsBinPath = explode( ' ', $swWhereIsFirstLine, 3);
283 if ( count( $swWhereIsBinPath ) > 1 )
284 $wBinPath = dirname( $swWhereIsBinPath[1] );
286 $swPathLine = explode( ';', $_SERVER['PATH'] );
287 $swPathFound = false;
288 foreach( $swPathLine as $swPathDir ) {
289 if ( file_exists( $swPathDir . '/' . $swMathCmd . '.exe' ) && ($swPathFound === false) ) {
290 $wBinPath = $swPathDir . '/';
295 if ( file_exists( $binPath . $swMathCmd ) ||
file_exists( $wBinPath . $swMathCmd ) ) {
296 $swMathInfo = self
::execOutput( $swMathCmd . ' ' . $swMathParam[$swMath] );
297 $swMathLine = explode( "\n", $swMathInfo, 2);
298 $swMathVerInfo = $swMathLine[0];
299 if ( !strcmp( $swMath, 'gs' ) )
300 $swMathVerInfo = str_replace( 'GPL Ghostscript ', '', $swMathVerInfo );
301 else if ( !strcmp( $swMath, 'dvips' ) ) {
302 $swMathVerParts = explode( ' ' , $swMathVerInfo );
303 $swMathVerInfo = $swMathVerParts[3];
304 } else if ( !strcmp( $swMath, 'imagemagick' ) ) {
305 list( $head, $tail ) = explode( 'ImageMagick', $swMathVerInfo );
306 list( $swMathVerInfo ) = explode('http://www.imagemagick.org', $tail );
308 $swMathVer[$swMath] = trim( $swMathVerInfo );
309 $software["[$swMathURL[$swMath] $swMathName[$swMath]]"] = $swMathVer[$swMath];
315 // Allow a hook to add/remove items
316 wfRunHooks( 'SoftwareInfo', array( &$software ) );
318 $out = Xml
::element( 'h2', array( 'id' => 'mw-version-software' ), wfMsg( 'version-software' ) ) .
319 Xml
::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-software' ) ) .
321 <th>" . wfMsg( 'version-software-product' ) . "</th>
322 <th>" . wfMsg( 'version-software-version' ) . "</th>
324 foreach( $software as $name => $version ) {
326 <td>" . $name . "</td>
327 <td>" . $version . "</td>
330 return $out . Xml
::closeElement( 'table' );
334 * Return a string of the MediaWiki version with SVN revision if available
338 public static function getVersion( $flags = '' ) {
339 global $wgVersion, $IP;
340 wfProfileIn( __METHOD__
);
341 $svn = self
::getSvnRevision( $IP, false, false , false );
342 $svnCo = self
::getSvnRevision( $IP, true, false , false );
344 $version = $wgVersion;
345 } elseif( $flags === 'nodb' ) {
346 $version = "$wgVersion (r$svnCo)";
348 $version = $wgVersion . wfMsg( 'version-svn-revision', $svn, $svnCo );
350 wfProfileOut( __METHOD__
);
355 * Return a string of the MediaWiki version with a link to SVN revision if
360 public static function getVersionLinked() {
361 global $wgVersion, $IP;
362 wfProfileIn( __METHOD__
);
363 $svn = self
::getSvnRevision( $IP, false, false, false );
364 $svnCo = self
::getSvnRevision( $IP, true, false, false );
365 $svnDir = self
::getSvnRevision( $IP, true, false, true );
366 $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/';
367 $viewvcEnd = '/?pathrev=';
368 $viewvc = $viewvcStart . $svnDir . $viewvcEnd;
369 $version = $svn ?
$wgVersion . " [{$viewvc}{$svnCo} " . wfMsg( 'version-svn-revision', $svn, $svnCo ) . ']' : $wgVersion;
370 wfProfileOut( __METHOD__
);
374 /** Generate wikitext showing extensions name, URL, author and description */
375 function extensionCredits() {
376 global $wgExtensionCredits, $wgExtensionFunctions, $wgParser, $wgSkinExtensionFunctions;
378 if ( ! count( $wgExtensionCredits ) && ! count( $wgExtensionFunctions ) && ! count( $wgSkinExtensionFunctions ) )
381 $extensionTypes = array(
382 'specialpage' => wfMsg( 'version-specialpages' ),
383 'parserhook' => wfMsg( 'version-parserhooks' ),
384 'variable' => wfMsg( 'version-variables' ),
385 'media' => wfMsg( 'version-mediahandlers' ),
386 'other' => wfMsg( 'version-other' ),
388 wfRunHooks( 'SpecialVersionExtensionTypes', array( &$this, &$extensionTypes ) );
390 $out = Xml
::element( 'h2', array( 'id' => 'mw-version-ext' ), wfMsg( 'version-extensions' ) ) .
391 Xml
::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-ext' ) );
393 foreach ( $extensionTypes as $type => $text ) {
394 if ( isset ( $wgExtensionCredits[$type] ) && count ( $wgExtensionCredits[$type] ) ) {
395 $out .= $this->openExtType( $text );
397 usort( $wgExtensionCredits[$type], array( $this, 'compare' ) );
399 foreach ( $wgExtensionCredits[$type] as $extension ) {
402 $subVersionCo = null;
404 if ( isset( $extension['path'] ) ) {
405 $subVersion = self
::getSvnRevision(dirname($extension['path']), false, true, false);
406 $subVersionCo = self
::getSvnRevision(dirname($extension['path']), true, true, false);
407 $subVersionDir = self
::getSvnRevision(dirname($extension['path']), false, true, true);
409 $viewvc = $subVersionDir . $subVersionCo;
411 if ( isset( $extension['version'] ) ) {
412 $version = $extension['version'];
415 $out .= $this->formatCredits(
416 isset ( $extension['name'] ) ?
$extension['name'] : '',
421 isset ( $extension['author'] ) ?
$extension['author'] : '',
422 isset ( $extension['url'] ) ?
$extension['url'] : null,
423 isset ( $extension['description'] ) ?
$extension['description'] : '',
424 isset ( $extension['descriptionmsg'] ) ?
$extension['descriptionmsg'] : null
430 if ( count( $wgExtensionFunctions ) ) {
431 $out .= $this->openExtType( wfMsg( 'version-extension-functions' ) );
432 $out .= '<tr><td colspan="4">' . $this->listToText( $wgExtensionFunctions ) . "</td></tr>\n";
435 if ( $cnt = count( $tags = $wgParser->getTags() ) ) {
436 for ( $i = 0; $i < $cnt; ++
$i )
437 $tags[$i] = "<{$tags[$i]}>";
438 $out .= $this->openExtType( wfMsg( 'version-parser-extensiontags' ) );
439 $out .= '<tr><td colspan="4">' . $this->listToText( $tags ). "</td></tr>\n";
442 if( $cnt = count( $fhooks = $wgParser->getFunctionHooks() ) ) {
443 $out .= $this->openExtType( wfMsg( 'version-parser-function-hooks' ) );
444 $out .= '<tr><td colspan="4">' . $this->listToText( $fhooks ) . "</td></tr>\n";
447 if ( count( $wgSkinExtensionFunctions ) ) {
448 $out .= $this->openExtType( wfMsg( 'version-skin-extension-functions' ) );
449 $out .= '<tr><td colspan="4">' . $this->listToText( $wgSkinExtensionFunctions ) . "</td></tr>\n";
451 $out .= Xml
::closeElement( 'table' );
455 /** Callback to sort extensions by type */
456 function compare( $a, $b ) {
458 if( $a['name'] === $b['name'] ) {
461 return $wgLang->lc( $a['name'] ) > $wgLang->lc( $b['name'] )
467 function formatCredits( $name, $version = null, $subVersion = null, $subVersionCo = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
468 $haveSubversion = $subVersion;
469 $extension = isset( $url ) ?
"[$url $name]" : $name;
470 $version = isset( $version ) ?
'<span class="mw-version-ext-version">' . wfMsg( 'version-version', $version ) . '</span>' : '';
471 $subVersion = isset( $subVersion ) ?
wfMsg( 'version-svn-revision', $subVersion, $subVersionCo ) : '';
472 $subVersion = isset( $subVersionURL ) ?
"[$subVersionURL $subVersion]" : $subVersion;
474 # Look for a localized description
475 if( isset( $descriptionMsg ) ) {
476 $msg = wfMsg( $descriptionMsg );
477 if ( !wfEmptyMsg( $descriptionMsg, $msg ) && $msg != '' ) {
482 if ( $haveSubversion ) {
484 <td><em>$extension $version</em></td>
485 <td><em>$subVersion</em></td>";
488 <td colspan=\"2\"><em>$extension $version</em></td>";
490 $extDescAuthor = "<td>$description</td>
491 <td>" . $this->listToText( (array)$author ) . "</td>
493 return $ret = $extNameVer . $extDescAuthor;
503 if ( count( $wgHooks ) ) {
504 $myWgHooks = $wgHooks;
507 $ret = Xml
::element( 'h2', array( 'id' => 'mw-version-hooks' ), wfMsg( 'version-hooks' ) ) .
508 Xml
::openElement( 'table', array( 'class' => 'wikitable', 'id' => 'sv-hooks' ) ) .
510 <th>" . wfMsg( 'version-hook-name' ) . "</th>
511 <th>" . wfMsg( 'version-hook-subscribedby' ) . "</th>
514 foreach ( $myWgHooks as $hook => $hooks )
517 <td>" . $this->listToText( $hooks ) . "</td>
520 $ret .= Xml
::closeElement( 'table' );
526 private function openExtType($text, $name = null) {
527 $opt = array( 'colspan' => 4 );
530 if(!$this->firstExtOpened
) {
531 // Insert a spacing line
532 $out .= '<tr class="sv-space">' . Xml
::element( 'td', $opt ) . "</tr>\n";
534 $this->firstExtOpened
= false;
536 if($name) { $opt['id'] = "sv-$name"; }
538 $out .= "<tr>" . Xml
::element( 'th', $opt, $text) . "</tr>\n";
546 $ip = str_replace( '--', ' - ', htmlspecialchars( wfGetIP() ) );
547 return "<!-- visited from $ip -->\n" .
548 "<span style='display:none'>visited from $ip</span>";
555 function listToText( $list ) {
556 $cnt = count( $list );
559 // Enforce always returning a string
560 return (string)self
::arrayToString( $list[0] );
561 } elseif ( $cnt == 0 ) {
566 return $wgLang->listToText( array_map( array( __CLASS__
, 'arrayToString' ), $list ) );
571 * @param mixed $list Will convert an array to string if given and return
572 * the paramater unaltered otherwise
575 static function arrayToString( $list ) {
576 if( is_array( $list ) && count( $list ) == 1 )
578 if( is_object( $list ) ) {
579 $class = get_class( $list );
581 } elseif ( !is_array( $list ) ) {
584 if( is_object( $list[0] ) )
585 $class = get_class( $list[0] );
588 return "($class, {$list[1]})";
593 * Retrieve the revision number of a Subversion working directory.
595 * @param String $dir Directory of the svn checkout
596 * @param Boolean $coRev optional to return value whether is Last Modified
597 * or Checkout revision number
598 * @param Boolean $extension optional to check the path whether is from
599 * Wikimedia SVN server or not
600 * @param Boolean $relPath optional to get the end part of the checkout path
601 * @return mixed revision number as int, end part of the checkout path,
602 * or false if not a SVN checkout
604 public static function getSvnRevision( $dir, $coRev = false, $extension = false, $relPath = false) {
605 // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
606 $entries = $dir . '/.svn/entries';
608 if( !file_exists( $entries ) ) {
612 $content = file( $entries );
614 // check if file is xml (subversion release <= 1.3) or not (subversion release = 1.4)
615 if( preg_match( '/^<\?xml/', $content[0] ) ) {
616 // subversion is release <= 1.3
617 if( !function_exists( 'simplexml_load_file' ) ) {
618 // We could fall back to expat... YUCK
622 // SimpleXml whines about the xmlns...
623 wfSuppressWarnings();
624 $xml = simplexml_load_file( $entries );
628 foreach( $xml->entry
as $entry ) {
629 if( $xml->entry
[0]['name'] == '' ) {
630 // The directory entry should always have a revision marker.
631 if( $entry['revision'] ) {
632 return intval( $entry['revision'] );
639 // subversion is release 1.4 or above
641 $endPath = strstr( $content[4], 'tags' );
643 $endPath = strstr( $content[4], 'branches' );
645 $endPath = strstr( $content[4], 'trunk' );
650 $endPath = trim ( $endPath );
652 $wmSvnPath = 'svn.wikimedia.org/svnroot/mediawiki';
653 $isWMSvn = strstr($content[5],$wmSvnPath);
654 if (!strcmp($isWMSvn,null)) {
657 $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/';
658 if (strstr( $content[4], 'trunk' ))
659 $viewvcEnd = '/?pathrev=';
661 // Avoids 404 error using pathrev when it does not found
662 $viewvcEnd = '/?revision=';
663 $viewvc = $viewvcStart . $endPath . $viewvcEnd;
670 // get the directory checkout revsion number
671 return intval( $content[3]) ;
673 // get the directory last modified revision number
674 return intval( $content[10] );