Beispiel #1
0
 static function generateGraph($oldtime, $newtime)
 {
     global $global_dontlogshell;
     $oldv = $global_dontlogshell;
     $global_dontlogshell = true;
     $list = lscandir_without_dot("__path_httpd_root");
     foreach ($list as $l) {
         if (!lxfile_exists("__path_httpd_root/{$l}/stats")) {
             continue;
         }
         $total = webtraffic::getEachwebfilequota("__path_httpd_root/{$l}/stats/{$l}-custom_log", $oldtime, $newtime);
         execRrdSingle("webtraffic", "ABSOLUTE", $l, $total * 1024 * 1024);
     }
     $global_dontlogshell = $oldv;
 }
Beispiel #2
0
 function runStats()
 {
     log_log("run_stats", "Running stats");
     $list[$this->nname] = $this;
     webtraffic::run_awstats($this->__var_statsprog, $list);
 }
Beispiel #3
0
 static function getTrafficInfo($name)
 {
     $oldtime = time() - 40 * 3600;
     $newtime = time();
     $file = "__path_httpd_root/{$name}/stats/{$name}-custom_log";
     $file = expand_real_root($file);
     $fp = @lfopen($file, "r");
     $total = 0;
     dprint("\n{$file}: " . @date('Y-m-d-H-i-s', $oldtime) . " {$newtime} " . @date('Y-m-d-H-i-s', $newtime) . "\n");
     if (!$fp) {
         dprint("File Does Not Exist:returning Zero");
         return 0;
     }
     $fsize = lfilesize($file);
     if ($fsize <= 10) {
         dprint("File Size is Less Than Zero and Returning Zero:\n");
         return "";
     }
     dprint("File Size is :{$fsize}\n\n\n");
     if ($fsize > 20 * 1024) {
         fseek($fp, -19 * 1024, SEEK_END);
         $line = fgets($fp);
     }
     $i = 3;
     $total = 0;
     $count = 0;
     while (!feof($fp)) {
         $count++;
         $line = fgets($fp);
         $res[] = webtraffic::apacheLogFullString($line);
     }
     $c = 0;
     foreach ($res as $k => $r) {
         $c++;
         if ($count - 50 > $c) {
             unset($res[$k]);
         }
     }
     $ncount = 0;
     foreach ($res as $r) {
         if (!$r['Time']) {
             continue;
         }
         $file = strfrom($r['Request'], " ");
         $file = strtil($file, "HTTP");
         $time = trim($r['Time'], "[]");
         $time = strtil($time, " ");
         $o['realtime'] = $r['realtime'];
         $o['time'] = $time;
         $o['nname'] = $ncount;
         $o['file'] = $file;
         $o['referer'] = $r['Referer'];
         $o['remote_host'] = $r['Remote-Host'];
         $out[] = $o;
         $ncount++;
     }
     return $out;
 }