Changeset 497


Ignore:
Timestamp:
11/10/08 00:19:35 (3 years ago)
Author:
RobManson
Message:

Item38: Moved backticks to TWiki::Sandbox->sysCommand()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/PageStatsPlugin/lib/TWiki/Plugins/PageStatsPlugin.pm

    r245 r497  
    7575 
    7676    my $dd = TWiki::Func::getDataDir(); 
    77     my @pagestats = `grep $web\\.$topic $dd/log*.txt | grep -E \\(view\\|save\\)`; 
     77    #my @pagestats = `grep $web\\.$topic $dd/log*.txt | grep -E \\(view\\|save\\)`; 
     78    use TWiki::Sandbox; 
     79    my $sandbox = TWiki::Sandbox->new(); 
     80    my ($lsresp, $lsexit) = $sandbox->sysCommand("ls -1 $dd"); 
     81    my @resp = split(/\n/, $lsresp); 
     82    my @logs = grep(/log2.*.txt/, @resp); 
     83    my $logs = ""; 
     84    foreach my $l (@logs) { 
     85        $logs .= "$dd/$l "; 
     86    } 
     87    my $pat = "$web.$topic"; 
     88    my $x = 'grep -e '.$pat.' -e view -e save '.$logs; 
     89    my ($grepresp, $grepexit) = $sandbox->sysCommand('grep -e '.$pat.' -e view -e save '.$logs); 
     90    my @pagestats = split(/$/, $grepresp); 
    7891 
    7992    my $maxEntries = scalar &TWiki::Func::extractNameValuePair( $attributes, "max" ) || scalar @pagestats; 
Note: See TracChangeset for help on using the changeset viewer.