diff options
author | Bill Marquette <billm@pfsense.org> | 2005-03-16 06:46:54 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2005-03-16 06:46:54 +0000 |
commit | 3d04e6799abee0b1c3ef5cc7fd630a9ca6d33267 (patch) | |
tree | 303deabb39e4791718d6069b19c27be21047cf5e | |
parent | 5cfc0cb8368dd8dc6915ae0c9b43d5cb9d46da2d (diff) | |
download | pfsense-packages-3d04e6799abee0b1c3ef5cc7fd630a9ca6d33267.tar.gz pfsense-packages-3d04e6799abee0b1c3ef5cc7fd630a9ca6d33267.tar.bz2 pfsense-packages-3d04e6799abee0b1c3ef5cc7fd630a9ca6d33267.zip |
rearrange some code so we only load files that actually exist
keeping inline with the filename $trafficshaper == $shaper
-rw-r--r-- | packages/carp_sync_server.php | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/packages/carp_sync_server.php b/packages/carp_sync_server.php index df9f429c..dbdf45b0 100644 --- a/packages/carp_sync_server.php +++ b/packages/carp_sync_server.php @@ -35,26 +35,34 @@ require_once("xmlparse_pkg.inc"); require_once("filter.inc"); if($config['installedpackages']['carpsettings']['config'] != "") { - $rules = return_filename_as_string("{$g['tmp_path']}/filter_section.txt"); - $aliases = return_filename_as_string("{$g['tmp_path']}/aliases_section.txt"); - $nat = return_filename_as_string("{$g['tmp_path']}/nat_section.txt"); - $trafficshaper = return_filename_as_string("{$g['tmp_path']}/shaper_section.txt"); - if($rules <> "") { - restore_config_section("filter", $rules); - unlink("{$g['tmp_path']}/filter_section.txt"); + + /* load and restore all files */ + if (file_exists("{$g['tmp_path']}/filter_section.txt")) { + $rules = return_filename_as_string("{$g['tmp_path']}/filter_section.txt"); + if($rules <> "") + restore_config_section("filter", $rules); + unlink("{$g['tmp_path']}/filter_section.txt"); } - if($aliases <> "") { - restore_config_section("aliases", $aliases); - unlink("{$g['tmp_path']}/aliases_section.txt"); + if (file_exists("{$g['tmp_path']}/aliases_section.txt")) { + $aliases = return_filename_as_string("{$g['tmp_path']}/aliases_section.txt"); + if($aliases <> "") + restore_config_section("aliases", $aliases); + unlink("{$g['tmp_path']}/aliases_section.txt"); } - if($nat <> "") { - restore_config_section("nat", $nat); - unlink("{$g['tmp_path']}/nat_section.txt"); + if (file_exists("{$g['tmp_path']}/nat_section.txt")) { + $nat = return_filename_as_string("{$g['tmp_path']}/nat_section.txt"); + if($nat <> "") + restore_config_section("nat", $nat); + unlink("{$g['tmp_path']}/nat_section.txt"); } - if($trafficshaper <> "") { - restore_config_section("shaper", $trafficshaper); - unlink("{$g['tmp_path']}/shaper_section.txt"); + if (file_exists("{$g['tmp_path']}/shaper_section.txt")) { + $shaper = return_filename_as_string("{$g['tmp_path']}/shaper_section.txt"); + if($shaper <> "") + restore_config_section("shaper", $shaper); + unlink("{$g['tmp_path']}/shaper_section.txt"); } + + /* reconfigure */ filter_configure(); } |