Index: trunk/phase3/includes/specials/SpecialVersion.php |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | public static function getVersion() { |
116 | 116 | global $wgVersion, $IP; |
117 | 117 | wfProfileIn( __METHOD__ ); |
118 | | - $svn = self::getSvnRevision( $IP, false ); |
| 118 | + $svn = self::getSvnRevision( $IP, false , false); |
119 | 119 | $version = $svn ? $wgVersion . wfMsg( 'version-svn-revision', $svn ) : $wgVersion; |
120 | 120 | wfProfileOut( __METHOD__ ); |
121 | 121 | return $version; |
— | — | @@ -129,8 +129,11 @@ |
130 | 130 | public static function getVersionLinked() { |
131 | 131 | global $wgVersion, $IP; |
132 | 132 | wfProfileIn( __METHOD__ ); |
133 | | - $svn = self::getSvnRevision( $IP, false ); |
134 | | - $viewvc = 'http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/?pathrev='; |
| 133 | + $svn = self::getSvnRevision( $IP, false, false ); |
| 134 | + $svnDir = self::getSvnRevision( $IP, false, true ); |
| 135 | + $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/'; |
| 136 | + $viewvcEnd = '/?pathrev='; |
| 137 | + $viewvc = $viewvcStart . $svnDir . $viewvcEnd; |
135 | 138 | $version = $svn ? $wgVersion . " [{$viewvc}{$svn} " . wfMsg( 'version-svn-revision', $svn ) . ']' : $wgVersion; |
136 | 139 | wfProfileOut( __METHOD__ ); |
137 | 140 | return $version; |
— | — | @@ -164,8 +167,13 @@ |
165 | 168 | foreach ( $wgExtensionCredits[$type] as $extension ) { |
166 | 169 | $version = null; |
167 | 170 | $subVersion = null; |
168 | | - if (isset($extension['path'])) |
169 | | - $subVersion = self::getSvnRevision(dirname($extension['path']), true); |
| 171 | + $viewvc = null; |
| 172 | + if ( isset( $extension['path'] ) ) { |
| 173 | + $subVersion = self::getSvnRevision(dirname($extension['path']), true, false); |
| 174 | + $subVersionDir = self::getSvnRevision(dirname($extension['path']), true, true); |
| 175 | + if ($subVersionDir) |
| 176 | + $viewvc = $subVersionDir . $subVersion; |
| 177 | + } |
170 | 178 | if ( isset( $extension['version'] ) ) { |
171 | 179 | $version = $extension['version']; |
172 | 180 | } |
— | — | @@ -174,6 +182,7 @@ |
175 | 183 | isset ( $extension['name'] ) ? $extension['name'] : '', |
176 | 184 | $version, |
177 | 185 | $subVersion, |
| 186 | + $viewvc, |
178 | 187 | isset ( $extension['author'] ) ? $extension['author'] : '', |
179 | 188 | isset ( $extension['url'] ) ? $extension['url'] : null, |
180 | 189 | isset ( $extension['description'] ) ? $extension['description'] : '', |
— | — | @@ -220,10 +229,11 @@ |
221 | 230 | } |
222 | 231 | } |
223 | 232 | |
224 | | - function formatCredits( $name, $version = null, $subVersion = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) { |
| 233 | + function formatCredits( $name, $version = null, $subVersion = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) { |
225 | 234 | $extension = isset( $url ) ? "[$url $name]" : $name; |
226 | 235 | $version = isset( $version ) ? wfMsg( 'version-version', $version ) : ''; |
227 | 236 | $subVersion = isset( $subVersion ) ? wfMsg( 'version-svn-revision', $subVersion ) : ''; |
| 237 | + $subVersion = isset( $subVersionURL ) ? "[$subVersionURL $subVersion]" : $subVersion; |
228 | 238 | |
229 | 239 | # Look for a localized description |
230 | 240 | if( isset( $descriptionMsg ) ) { |
— | — | @@ -341,7 +351,7 @@ |
342 | 352 | * @param string $dir |
343 | 353 | * @return mixed revision number as int, or false if not a SVN checkout |
344 | 354 | */ |
345 | | - public static function getSvnRevision( $dir , $extension = false) { |
| 355 | + public static function getSvnRevision( $dir , $extension = false, $relPath = false) { |
346 | 356 | // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html |
347 | 357 | $entries = $dir . '/.svn/entries'; |
348 | 358 | |
— | — | @@ -377,6 +387,31 @@ |
378 | 388 | return false; |
379 | 389 | } else { |
380 | 390 | // subversion is release 1.4 or above |
| 391 | + if ($relPath) { |
| 392 | + $endPath = strstr( $content[4], 'tags' ); |
| 393 | + if (!$endPath) { |
| 394 | + $endPath = strstr( $content[4], 'branches' ); |
| 395 | + if (!$endPath) { |
| 396 | + $endPath = strstr( $content[4], 'trunk' ); |
| 397 | + if (!$endPath) |
| 398 | + return false; |
| 399 | + } |
| 400 | + } |
| 401 | + $endPath = trim ( $endPath ); |
| 402 | + if ($extension) { |
| 403 | + $wmSvnPath = 'svn.wikimedia.org/svnroot/mediawiki'; |
| 404 | + $isWMSvn = strstr($content[5],$wmSvnPath); |
| 405 | + if (!strcmp($isWMSvn,null)) { |
| 406 | + return false; |
| 407 | + } else { |
| 408 | + $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/'; |
| 409 | + $viewvcEnd = '/?pathrev='; |
| 410 | + $viewvc = $viewvcStart . $endPath . $viewvcEnd; |
| 411 | + return $viewvc; |
| 412 | + } |
| 413 | + } |
| 414 | + return $endPath; |
| 415 | + } |
381 | 416 | if ($extension) |
382 | 417 | // get the last file revsion number |
383 | 418 | return intval( $content[10]) ; |