summaryrefslogtreecommitdiffstats
path: root/usr/local
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-02-04 17:06:43 -0200
committerRenato Botelho <garga@FreeBSD.org>2014-02-04 17:06:43 -0200
commit7b7ad7f62fe2946ce7521581aac2b2d8387254ad (patch)
tree795a7789a6293ce91b4a6b561b09b465a0d537e6 /usr/local
parent552f5a6a5ffc6d6279c8b86a71996de2243d4c50 (diff)
downloadpfsense-7b7ad7f62fe2946ce7521581aac2b2d8387254ad.zip
pfsense-7b7ad7f62fe2946ce7521581aac2b2d8387254ad.tar.gz
Simplify logic calling grep less times, as done on mail_reports.inc on 2c6efc9
Diffstat (limited to 'usr/local')
-rwxr-xr-xusr/local/www/guiconfig.inc12
1 files changed, 4 insertions, 8 deletions
diff --git a/usr/local/www/guiconfig.inc b/usr/local/www/guiconfig.inc
index bd97e7e..19c519f 100755
--- a/usr/local/www/guiconfig.inc
+++ b/usr/local/www/guiconfig.inc
@@ -583,11 +583,9 @@ function dump_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinvert
$logarr = "";
$grepline = " ";
if(is_array($grepfor))
- foreach($grepfor as $agrep)
- $grepline .= " | grep " . escapeshellarg($agrep);
+ $grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor));
if(is_array($grepinvert))
- foreach($grepinvert as $agrep)
- $grepline .= " | grep -v " . escapeshellarg($agrep);
+ $grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert));
if(file_exists($logfile) && filesize($logfile) == 0) {
$logarr = array("Log file started.");
} else {
@@ -628,11 +626,9 @@ function return_clog($logfile, $tail, $withorig = true, $grepfor = "", $grepinve
$logarr = "";
$grepline = " ";
if(is_array($grepfor))
- foreach($grepfor as $agrep)
- $grepline .= " | grep " . escapeshellarg($agrep);
+ $grepline .= " | /usr/bin/egrep " . escapeshellarg(implode("|", $grepfor));
if(is_array($grepinvert))
- foreach($grepinvert as $agrep)
- $grepline .= " | grep -v " . escapeshellarg($agrep);
+ $grepline .= " | /usr/bin/egrep -v " . escapeshellarg(implode("|", $grepinvert));
if($config['system']['disablesyslogclog']) {
exec("cat " . escapeshellarg($logfile) . "{$grepline} | /usr/bin/tail {$sor} -n " . escapeshellarg($tail), $logarr);
} else {
OpenPOWER on IntegriCloud