From ad310dcf307d3f8f473cebd21fc7b8f2875480ad Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 5 Jan 2005 01:07:40 +0000 Subject: Sync package more often with pfstat.conf --- packages/pfstat.xml | 67 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 29 deletions(-) (limited to 'packages/pfstat.xml') diff --git a/packages/pfstat.xml b/packages/pfstat.xml index 2f6e8aa2..1349bb55 100644 --- a/packages/pfstat.xml +++ b/packages/pfstat.xml @@ -177,44 +177,53 @@ - - - + + function sync_package() { + global $config; $fout = fopen("/usr/local/etc/pfstat.conf","w"); $leftgraphtext = ""; $rightgraphtext = ""; $isfirstleft = 0; $isfirstright = 0; - foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) { - foreach($rowhelper['row'] as $row) { - if($row['location'] == "left") { - if($isfirstleft == 1) $leftgraphtext .= ",\n"; - $leftgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; - $isfirstleft = 1; - } else { - if($isfirstright == 1) $rightgraphtext .= ",\n"; - $rightgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; - $isfirstright = 1; + if($config['installedpackages']['pfstat']['config'] != "") { + foreach($config['installedpackages']['pfstat']['config'] as $rowhelper) { + foreach($rowhelper['row'] as $row) { + if($row['location'] == "left") { + if($isfirstleft == 1) $leftgraphtext .= ",\n"; + $leftgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; + $isfirstleft = 1; + } else { + if($isfirstright == 1) $rightgraphtext .= ",\n"; + $rightgraphtext .= "graph " . $row['counters'] . " label \"" . $row['counters'] . "\" color " . $row['color'] . " " . $row['appearance']; + $isfirstright = 1; + } } } - } - foreach($config['installedpackages']['pfstat']['config'] as $pkgconfig) { - fwrite($fout, "image \"/usr/local/www/pfstat/" . $pkgconfig['imagename'] ."\" { \n"); - $from = $pkgconfig['from']; - if($from == "") $from = "30"; - fwrite($fout, "from " . $from . " " . $pkgconfig['fromclassification'] . " to now \n"); - fwrite($fout, "width " . $pkgconfig['graphsizewidth'] . " height " . $pkgconfig['graphsizeheight'] . " \n"); - if($leftgraphtext != "") { - fwrite($fout, " left \n"); - fwrite($fout, " " . $leftgraphtext . "\n"); - } - if($rightgraphtext != "") { - fwrite($fout, " right \n"); - fwrite($fout, " " . $rightgraphtext . "\n"); + foreach($config['installedpackages']['pfstat']['config'] as $pkgconfig) { + fwrite($fout, "image \"/usr/local/www/pfstat/" . $pkgconfig['imagename'] ."\" { \n"); + $from = $pkgconfig['from']; + if($from == "") $from = "30"; + fwrite($fout, "from " . $from . " " . $pkgconfig['fromclassification'] . " to now \n"); + fwrite($fout, "width " . $pkgconfig['graphsizewidth'] . " height " . $pkgconfig['graphsizeheight'] . " \n"); + if($leftgraphtext != "") { + fwrite($fout, " left \n"); + fwrite($fout, " " . $leftgraphtext . "\n"); + } + if($rightgraphtext != "") { + fwrite($fout, " right \n"); + fwrite($fout, " " . $rightgraphtext . "\n"); + } + fwrite($fout, "}\n\n"); } - fwrite($fout, "}\n\n"); + fclose($fout); } - fclose($fout); + } + sync_package(); + + + + + sync_package(); system("mkdir -p /usr/local/www/pfstat 2>/dev/null"); -- cgit v1.2.3