summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-05-17 01:36:03 +0000
committerColin Smith <colin@pfsense.org>2005-05-17 01:36:03 +0000
commit781beaaa8d3549f8ecc38a0559499a965b2e546e (patch)
treeaa7df201e7ad48be63e9cdc8f4e2a935d6520266 /etc
parenteba0b1d8539824167b18881f86455cb567a8713b (diff)
downloadpfsense-781beaaa8d3549f8ecc38a0559499a965b2e546e.zip
pfsense-781beaaa8d3549f8ecc38a0559499a965b2e546e.tar.gz
Change the behavior of parse_config() and a few other functions. This will (hopefully) fix the config hosification issues.
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/config.inc28
1 files changed, 12 insertions, 16 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index a07d995..72d7b31 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -133,15 +133,20 @@ EOD;
if(!$g['booting']) parse_config();
-function parse_config() {
+function parse_config($parse = false) {
global $config, $g;
config_lock();
- if(file_exists($g['tmp_path'] . '/config.cache')) {
- $config = unserialize(file_get_contents($g['tmp_path'] . '/config.cache'));
+ if(!$parse) {
+ if(file_exists($g['tmp_path'] . '/config.cache')) {
+ $config = unserialize(file_get_contents($g['tmp_path'] . '/config.cache'));
+ } else {
+ generate_config_cache();
+ parse_config();
+ }
} else {
+ $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
generate_config_cache();
- parse_config();
- }
+ }
config_unlock();
return true;
}
@@ -541,14 +546,6 @@ function write_config($desc="Unknown", $backup = true) {
fclose($fd);
conf_mount_ro();
-
- /* write config cache */
- $fd = @fopen("{$g['tmp_path']}/config.cache", "wb");
- if ($fd) {
- fwrite($fd, serialize($config));
- fclose($fd);
- }
-
generate_config_cache();
cleanup_backupcache();
config_unlock();
@@ -597,8 +594,7 @@ function config_restore($conffile) {
backup_config();
copy($conffile, "{$g['conf_path']}/config.xml");
write_config("Reverted to " . array_pop(explode("/", $conffile)) . ".", false);
- $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
- generate_config_cache();
+ $config = parse_config(true);
conf_mount_ro();
config_unlock();
@@ -1045,4 +1041,4 @@ function backup_config() {
fclose($bakout);
return true;
}
-?> \ No newline at end of file
+?>
OpenPOWER on IntegriCloud