diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2005-01-05 01:07:40 +0000 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2005-01-05 01:07:40 +0000 |
commit | ad310dcf307d3f8f473cebd21fc7b8f2875480ad (patch) | |
tree | 063fa93249a2d76180bf028437458909391408ef /packages/pfstat.xml | |
parent | e9e69df051330e558f3bd3f93940678b410346ba (diff) | |
download | pfsense-packages-ad310dcf307d3f8f473cebd21fc7b8f2875480ad.tar.gz pfsense-packages-ad310dcf307d3f8f473cebd21fc7b8f2875480ad.tar.bz2 pfsense-packages-ad310dcf307d3f8f473cebd21fc7b8f2875480ad.zip |
Sync package more often with pfstat.conf
Diffstat (limited to 'packages/pfstat.xml')
-rw-r--r-- | packages/pfstat.xml | 67 |
1 files changed, 38 insertions, 29 deletions
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 @@ </rowhelper> </field> </fields> - <custom_add_php_command_late> - </custom_add_php_command_late> - <custom_php_resync_config_command> + <custom_php_command_before_form> + 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(); + </custom_php_command_before_form> + <custom_add_php_command_late> + </custom_add_php_command_late> + <custom_php_resync_config_command> + sync_package(); </custom_php_resync_config_command> <custom_php_install_command> system("mkdir -p /usr/local/www/pfstat 2>/dev/null"); |