r50106 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50105‎ | r50106 | r50107 >
Date:14:09, 1 May 2009
Author:shinjiman
Status:resolved (Comments)
Tags:
Comment:
Follow up r49997, showing both last modified and checkout revision number for the directory per Code Review.
Modified paths:
  • /trunk/phase3/includes/specials/SpecialVersion.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesQqq.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialVersion.php
@@ -114,8 +114,9 @@
115115 public static function getVersion() {
116116 global $wgVersion, $IP;
117117 wfProfileIn( __METHOD__ );
118 - $svn = self::getSvnRevision( $IP, false , false);
119 - $version = $svn ? $wgVersion . wfMsg( 'version-svn-revision', $svn ) : $wgVersion;
 118+ $svn = self::getSvnRevision( $IP, false, false , false);
 119+ $svnCo = self::getSvnRevision( $IP, true, false , false);
 120+ $version = $svn ? $wgVersion . wfMsg( 'version-svn-revision', $svn, $svnCo ) : $wgVersion;
120121 wfProfileOut( __METHOD__ );
121122 return $version;
122123 }
@@ -129,12 +130,13 @@
130131 public static function getVersionLinked() {
131132 global $wgVersion, $IP;
132133 wfProfileIn( __METHOD__ );
133 - $svn = self::getSvnRevision( $IP, false, false );
134 - $svnDir = self::getSvnRevision( $IP, false, true );
 134+ $svn = self::getSvnRevision( $IP, false, false, false );
 135+ $svnCo = self::getSvnRevision( $IP, true, false, false );
 136+ $svnDir = self::getSvnRevision( $IP, true, false, true );
135137 $viewvcStart = 'http://svn.wikimedia.org/viewvc/mediawiki/';
136138 $viewvcEnd = '/?pathrev=';
137139 $viewvc = $viewvcStart . $svnDir . $viewvcEnd;
138 - $version = $svn ? $wgVersion . " [{$viewvc}{$svn} " . wfMsg( 'version-svn-revision', $svn ) . ']' : $wgVersion;
 140+ $version = $svn ? $wgVersion . " [{$viewvc}{$svnCo} " . wfMsg( 'version-svn-revision', $svn, $svnCo ) . ']' : $wgVersion;
139141 wfProfileOut( __METHOD__ );
140142 return $version;
141143 }
@@ -167,10 +169,12 @@
168170 foreach ( $wgExtensionCredits[$type] as $extension ) {
169171 $version = null;
170172 $subVersion = null;
 173+ $subVersionCo = null;
171174 $viewvc = null;
172175 if ( isset( $extension['path'] ) ) {
173 - $subVersion = self::getSvnRevision(dirname($extension['path']), true, false);
174 - $subVersionDir = self::getSvnRevision(dirname($extension['path']), true, true);
 176+ $subVersion = self::getSvnRevision(dirname($extension['path']), false, true, false);
 177+ $subVersionCo = self::getSvnRevision(dirname($extension['path']), true, true, false);
 178+ $subVersionDir = self::getSvnRevision(dirname($extension['path']), false, true, true);
175179 if ($subVersionDir)
176180 $viewvc = $subVersionDir . $subVersion;
177181 }
@@ -182,6 +186,7 @@
183187 isset ( $extension['name'] ) ? $extension['name'] : '',
184188 $version,
185189 $subVersion,
 190+ $subVersionCo,
186191 $viewvc,
187192 isset ( $extension['author'] ) ? $extension['author'] : '',
188193 isset ( $extension['url'] ) ? $extension['url'] : null,
@@ -229,10 +234,10 @@
230235 }
231236 }
232237
233 - function formatCredits( $name, $version = null, $subVersion = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
 238+ function formatCredits( $name, $version = null, $subVersion = null, $subVersionCo = null, $subVersionURL = null, $author = null, $url = null, $description = null, $descriptionMsg = null ) {
234239 $extension = isset( $url ) ? "[$url $name]" : $name;
235240 $version = isset( $version ) ? wfMsg( 'version-version', $version ) : '';
236 - $subVersion = isset( $subVersion ) ? wfMsg( 'version-svn-revision', $subVersion ) : '';
 241+ $subVersion = isset( $subVersion ) ? wfMsg( 'version-svn-revision', $subVersion, $subVersionCo ) : '';
237242 $subVersion = isset( $subVersionURL ) ? "[$subVersionURL $subVersion]" : $subVersion;
238243
239244 # Look for a localized description
@@ -348,10 +353,16 @@
349354 /**
350355 * Retrieve the revision number of a Subversion working directory.
351356 *
352 - * @param string $dir
353 - * @return mixed revision number as int, or false if not a SVN checkout
 357+ * @param String $dir Directory of the svn checkout
 358+ * @param Boolean $coRev optional to return value whether is Last Modified
 359+ * or Checkout revision number
 360+ * @param Boolean $extension optional to check the path whether is from
 361+ * Wikimedia SVN server or not
 362+ * @param Boolean $relPath optional to get the end part of the checkout path
 363+ * @return mixed revision number as int, end part of the checkout path,
 364+ * or false if not a SVN checkout
354365 */
355 - public static function getSvnRevision( $dir , $extension = false, $relPath = false) {
 366+ public static function getSvnRevision( $dir, $coRev = false, $extension = false, $relPath = false) {
356367 // http://svnbook.red-bean.com/nightly/en/svn.developer.insidewc.html
357368 $entries = $dir . '/.svn/entries';
358369
@@ -416,12 +427,12 @@
417428 }
418429 return $endPath;
419430 }
420 - if ($extension)
421 - // get the last file revsion number
422 - return intval( $content[10]) ;
 431+ if ($coRev)
 432+ // get the directory checkout revsion number
 433+ return intval( $content[3]) ;
423434 else
424 - // get the directory revsion number
425 - return intval( $content[3] );
 435+ // get the directory last modified revision number
 436+ return intval( $content[10] );
426437 }
427438 }
428439
Index: trunk/phase3/languages/messages/MessagesQqq.php
@@ -2853,8 +2853,11 @@
28542854 'version-hook-name' => 'Shown in [[Special:Version]]',
28552855 'version-hook-subscribedby' => 'Shown in [[Special:Version]]',
28562856 'version-version' => '{{Identical|Version}}',
2857 -'version-svn-revision' => 'This is being used in [[Special:Version]], preceeding the subversion revision numbers of the extensions loaded inside brackets, like this: "({{int:version-revision}} r012345")
 2857+'version-svn-revision' => 'This is being used in [[Special:Version]], preceeding the subversion revision numbers of both the core and the extensions loaded.
28582858
 2859+* $1: last modified directory revision number
 2860+* $2: checkout directory revision number
 2861+
28592862 {{Identical|Revision}}',
28602863 'version-software-product' => 'Shown in [[Special:Version]]',
28612864 'version-software-version' => '{{Identical|Version}}',
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -3826,7 +3826,7 @@
38273827 'version-hook-name' => 'Hook name',
38283828 'version-hook-subscribedby' => 'Subscribed by',
38293829 'version-version' => '(Version $1)',
3830 -'version-svn-revision' => '(r$1)', # only translate this message to other languages if you have to change it
 3830+'version-svn-revision' => '(r$1/r$2)', # only translate this message to other languages if you have to change it
38313831 'version-license' => 'License',
38323832 'version-software' => 'Installed software',
38333833 'version-software-product' => 'Product',

Follow-up revisions

RevisionCommit summaryAuthorDate
r50121Change to show the checkout revision number by default in Special:Version, pe...shinjiman07:44, 2 May 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r49997Follow up r49996, changing pathrev to revision on non-trunk preventing the 40...shinjiman06:01, 28 April 2009

Comments

#Comment by Brion VIBBER (talk | contribs)   23:47, 1 May 2009

This is utterly perplexing. Why include two numbers, one of which is possibly entirely useless and the other of which would actually give what we need (if combined with the appropriate branch or tag path, which is included only in the link and is not yet displayed)?

#Comment by Shinjiman (talk | contribs)   09:13, 4 June 2009

In r50121, the SVN checkout revision number is shown by default, however if the people wants to show the "last modified" revision, they can custiomise the message indeed.

#Comment by Tim Starling (talk | contribs)   08:33, 16 August 2009

Should be fixed as of r55130.

Status & tagging log