#163 browsers version sort problem

open
nobody
None
5
2012-10-11
2009-01-28
Makoto Takahashi
No

Some browser names contains "\", "-".

awstats.pl
- $a =~ m/^(\w+?)([\d.]+)?$/;
+ $a =~ m/^(\D+)([\d.]+)?$/;
my $a_family = $1;
my @a_ver = split(/./, $2);
- $b =~ m/^(\w+?)([\d.]+)?$/;
- $b =~ m/^(\D+)([\d.]+)?$/;
my $b_family = $1;
my @b_ver = split(/./, $2);

Discussion

  • There are browsers which name include figures. So update patch as follows.

    @@ -1578,12 +1532,24 @@
    # Return: -1, 0, 1
    #------------------------------------------------------------------------------
    sub SortBrowsers {
    - $a =~ m/^(\w+?)([\d.]+)?$/;
    - my $a_family = $1;
    - my @a_ver = split(/./, $2);
    - $b =~ m/^(\w+?)([\d.]+)?$/;
    - my $b_family = $1;
    - my @b_ver = split(/./, $2);
    + my $a_family = $a;
    + my @a_ver = ();
    + foreach my $family ( keys %BrowsersFamily ) {
    + if ( $a =~ /^$family/i ) {
    + $a =~ m/^(\D+)([\d.]+)?$/;
    + $a_family = $1;
    + @a_ver = split(/./, $2);
    + }
    + }
    + my $b_family = $b;
    + my @b_ver = ();
    + foreach my $family ( keys %BrowsersFamily ) {
    + if ( $b =~ /^$family/i ) {
    + $b =~ m/^(\D+)([\d.]+)?$/;
    + $b_family = $1;
    + @b_ver = split(/./, $2);
    + }
    + }

     
  • Added in CVS tree for next version.