Permalink
Browse files

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

git-svn-id: http://svn.foswiki.org/trunk/PageStatsPlugin@497 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
RobManson RobManson
RobManson authored and RobManson committed Nov 10, 2008
1 parent 44d7bcc commit e450e1ec2cdd187d311206a43dcd0cc3577f4dc0
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib/TWiki/Plugins/PageStatsPlugin.pm
@@ -74,7 +74,20 @@ sub handlePageStats
# my @text = $meta->find( 'FILEATTACHMENT' );
my $dd = TWiki::Func::getDataDir();
my @pagestats = `grep $web\\.$topic $dd/log*.txt | grep -E \\(view\\|save\\)`;
#my @pagestats = `grep $web\\.$topic $dd/log*.txt | grep -E \\(view\\|save\\)`;
use TWiki::Sandbox;
my $sandbox = TWiki::Sandbox->new();
my ($lsresp, $lsexit) = $sandbox->sysCommand("ls -1 $dd");
my @resp = split(/\n/, $lsresp);
my @logs = grep(/log2.*.txt/, @resp);
my $logs = "";
foreach my $l (@logs) {
$logs .= "$dd/$l ";
}
my $pat = "$web.$topic";
my $x = 'grep -e '.$pat.' -e view -e save '.$logs;
my ($grepresp, $grepexit) = $sandbox->sysCommand('grep -e '.$pat.' -e view -e save '.$logs);
my @pagestats = split(/$/, $grepresp);
my $maxEntries = scalar &TWiki::Func::extractNameValuePair( $attributes, "max" ) || scalar @pagestats;
$maxEntries = scalar @pagestats if $maxEntries > scalar @pagestats;

0 comments on commit e450e1e

Please sign in to comment.