Skip to content

Commit

Permalink
Item1209: don't apply the monthname to date lookup to month numbers.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/branches/Release01x00@2893 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
CrawfordCurrie authored and CrawfordCurrie committed Mar 6, 2009
1 parent 5f977d5 commit 71f5b12
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions core/lib/Foswiki/Configure/UIs/EXTENSIONS.pm
Expand Up @@ -28,10 +28,10 @@ my $MNAME = qr/$mnamess/i;
my %N2M;
foreach ( 0 .. $#MNAMES ) { $N2M{ $MNAMES[$_] } = $_; }

# Convert a date in the format dd Mmm yyyy to a unique integer
# Convert a date in the formats dd mm yyyy or dd Mmm yyyy to a unique integer
sub d2n {
my ( $d, $m, $y ) = @_;
return ( $y * 12 + $N2M{ lc($m) } ) * 31 + $d;
return ( $y * 12 + $m ) * 31 + $d;
}

# Download the report page from the repository, and extract a hash of
Expand Down Expand Up @@ -131,19 +131,19 @@ sub ui {
$text = '(pseudo-installed)';
}
elsif ( $ext->{installedVersion} =~
/^\s*(\d+)\.(\d+)(?:\.(\d+))/ )
/^\s*v?(\d+)\.(\d+)(?:\.(\d+))/ )
{

# X.Y.Z
# X.Y, X.Y.Z, vX.Y, vX.Y.Z
# Combine into one number; allows up to 1000
# revs in each field
my $irev = ( $1 * 1000 + $2 ) * 1000 + $3;
$text = 'Re-install';
if ( $ext->{version} =~ /^\s*(\d+)\.(\d+)(?:\.(\d+))/ )
if ( $ext->{version} =~ /^\s*v?(\d+)\.(\d+)(?:\.(\d+))?/ )
{

# Compatible version number
my $arev = ( $1 * 1000 + $2 ) * 1000 + $3;
my $arev = ( $1 * 1000 + $2 ) * 1000 + ($3 || 0);
if ( $arev > $irev ) {
$text = 'Upgrade';
}
Expand Down Expand Up @@ -177,11 +177,11 @@ sub ui {
/(\d{1,2}) ($MNAME) (\d{4})/ ) {

# dd Mmm yyyy date
my $idate = d2n( $1, $2, $3 );
my $idate = d2n( $1, $N2M{lc($2)}, $3 );
$text = 'Re-install';
if ( $ext->{version} =~
/(\d{1,2}) ($MNAME) (\d{4})/ ) {
my $adate = d2n( $1, $2, $3 );
my $adate = d2n( $1, $N2M{lc($2)}, $3 );
if ( $adate > $idate ) {
$text = 'Upgrade';
}
Expand Down

0 comments on commit 71f5b12

Please sign in to comment.