Ejemplo n.º 1
0
    $logdate = $logdate2 = 0;
    if (file_exists($logfile)) {
        $logdate = filemtime($logfile);
    }
    if (file_exists($logfile2)) {
        $logdate2 = filemtime($logfile2);
    }
    $cachedate = $clusterfile->mtime();
    if ($cachedate >= $logdate && $cachedate >= $logdate2) {
        $cachefound = true;
        $clusterfile->fetch();
    }
}
if (!$cachefound) {
    $scale = 60;
    $scalenames = array(60 => 'minute', 60 * 60 => 'hour', 60 * 60 * 24 => 'day');
    // *** Parse storage.log files ***
    $data = ezLogsGrapher::asum(ezLogsGrapher::parseLog($logfile, $scale), ezLogsGrapher::parseLog($logfile2, $scale));
    ksort($data);
    // *** build graph and store it ***
    $graphname = sysInfoTools::ezpI18ntr('SysInfo', 'files per ' . $scalenames[$scale]);
    $graph = ezLogsGrapher::graph($data, $graphname, $scale);
    if ($graph != false) {
        $clusterfile->fileStoreContents($cachefile, $graph);
    } else {
        $errormsg = ezLogsGrapher::lastError();
    }
}
// *** output ***
$tpl->setVariable('graphsource', $cachefile);
$tpl->setVariable('errormsg', $errormsg);