diff options
author | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-09-14 13:12:12 -0300 |
---|---|---|
committer | Marcello Coutinho <marcellocoutinho@gmail.com> | 2012-09-14 13:12:12 -0300 |
commit | 8c44f779ee7806ac816f028d7323cda77168bee8 (patch) | |
tree | d497c7b3483dd8881134b6bf3a69163450e668e6 /config/sarg/sarg_frame.php | |
parent | 502bb0945280d409e33b3a3eaaa3ff1596705828 (diff) | |
download | pfsense-packages-8c44f779ee7806ac816f028d7323cda77168bee8.tar.gz pfsense-packages-8c44f779ee7806ac816f028d7323cda77168bee8.tar.bz2 pfsense-packages-8c44f779ee7806ac816f028d7323cda77168bee8.zip |
sarg - add gzip feature to compress reports and save disk space
Diffstat (limited to 'config/sarg/sarg_frame.php')
-rwxr-xr-x | config/sarg/sarg_frame.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/config/sarg/sarg_frame.php b/config/sarg/sarg_frame.php index 13235b21..04fb7f30 100755 --- a/config/sarg/sarg_frame.php +++ b/config/sarg/sarg_frame.php @@ -40,9 +40,16 @@ else{ $url=($_REQUEST['file'] == ""?"index.html":$_REQUEST['file']); $dir="/usr/local/sarg-reports"; $rand=rand(100000000000,999999999999); +$report=""; if (file_exists("{$dir}/{$url}")) - { $report=file_get_contents("{$dir}/{$url}"); +else if (file_exists("{$dir}/{$url}.gz")) { + $data = gzfile("{$dir}/{$url}.gz"); + $report = implode($data); + unset ($data); + } +if ($report != "" ) + { $pattern[0]="/href=\W(\S+html)\W/"; $replace[0]="href=/sarg_frame.php?prevent=".$rand."&file=$prefix/$1"; $pattern[1]='/img src="\S+\W([a-zA-Z0-9.-]+.png)/'; |