array("20090621" => 0)); $total = 0; $firstdate = time() + 500; $lastdate = 0; $maxbuilds = 0; $handle = fopen ("./deploy/stats.txt", "a+"); while ($stats = fscanf($handle, "%s %s\n")) { list ($timestamp, $machine) = $stats; $builddate = date("Ymd", $timestamp); if (isset($builds[$machine][$builddate])) { $builds[$machine][$builddate] = $builds[$machine][$builddate] +1; } else { $builds[$machine][$builddate] = 1; } $total++; if($lastdate < $timestamp) $lastdate = $timestamp; if($firstdate > $timestamp) $firstdate = $timestamp; } fclose ($handle); ksort($builds, SORT_STRING); $timeframe = ( date("Y", $lastdate) - date("Y", $firstdate) ) * 365 + date("z", $lastdate) - date("z",$firstdate); if (isset($_GET["machine"])) { $selectedmachine = $_GET["machine"]; } if (isset($_GET["timeframe"])) { $maxdays = $_GET["timeframe"] + 1; if ($timeframe > $maxdays) $timeframe = $maxdays -1; } if ($timeframe < 80) { $hfactor = 3.1; } else { $hfactor = 1; } $modulovar = ceil($timeframe / 4) ; for ($i = 0 ; $i <= $timeframe ; $i++) { $statsdate = date("Ymd",$lastdate - ( ($timeframe - $i) * 86400 ) ) ; if ( $i % $modulovar == 1 ) { $xtick = date("d F Y", $lastdate - ( ($timeframe - $i) * 86400 )) ; } else { $xtick = ""; } $xticks .= "{v:$i, label:\"$xtick\"},\n"; foreach($builds as $machine => $foo) { if (isset($builds[$machine][$statsdate])) { $buildcount = $builds[$machine][$statsdate]; $yvars[$machine] .= "[ $i, $buildcount ], \n"; if($maxbuilds < $builds[$machine][$statsdate]) $maxbuilds = $builds[$machine][$statsdate]; } else { $yvars[$machine] .= "[ $i, 0 ], \n"; } } } ?> Statistics for the online image builder, number of builds per day

$foo) { print("

$machine
\n"); } } else { print("

$selectedmachine
\n"); } ?>


Total builds for all machines: