summaryrefslogtreecommitdiffstats
path: root/etc/inc
diff options
context:
space:
mode:
authorColin Smith <colin@pfsense.org>2005-05-21 22:40:52 +0000
committerColin Smith <colin@pfsense.org>2005-05-21 22:40:52 +0000
commit1b720c35b5757f4f3db65ea342fb658f7673e67d (patch)
treeb2e0f0b6a93460128e7cd4f497d22ee01c2bdc4b /etc/inc
parent360fb405d840baf6b4f553d79eee80523c89e00c (diff)
downloadpfsense-1b720c35b5757f4f3db65ea342fb658f7673e67d.zip
pfsense-1b720c35b5757f4f3db65ea342fb658f7673e67d.tar.gz
* Rely on the cached config only when we aren't writing - something seems to be getting lost in translation between XML -> serialize -> unserialize.
* Parse the config XML upon write - this seems to fix corruption issues.
Diffstat (limited to 'etc/inc')
-rw-r--r--etc/inc/config.inc21
1 files changed, 3 insertions, 18 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc
index ece0369..c0ef119 100644
--- a/etc/inc/config.inc
+++ b/etc/inc/config.inc
@@ -146,12 +146,6 @@ EOD;
mwexec("/sbin/mount -a");
}
-/* This global seems to be finicky. Default to always parsing.
-if(!$g['booting']) {
- $config = parse_config();
-}
-*/
-
$config = parse_config();
/****f* config/parse_config
@@ -166,7 +160,6 @@ function parse_config($parse = false) {
global $g;
config_lock();
- /*
if(!$parse) {
if(file_exists($g['tmp_path'] . '/config.cache')) {
$config = unserialize(file_get_contents($g['tmp_path'] . '/config.cache'));
@@ -182,26 +175,19 @@ function parse_config($parse = false) {
$config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
generate_config_cache($config);
}
- */
-
- /* ugly hack! config.cache is really borked. don't use until its fixed. */
- $config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
/* ugly hack! config.cache is really borked. don't use until its fixed. */
- //generate_config_cache($config);
-
+ //$config = parse_xml_config($g['conf_path'] . '/config.xml', $g['xml_rootobj']);
+
config_unlock();
return $config;
}
function generate_config_cache($config) {
global $g;
-
- /* ugly hack! config.cache is really borked. don't use until its fixed.
$configcache = fopen($g['tmp_path'] . '/config.cache', "w");
fwrite($configcache, serialize($config));
fclose($configcache);
- */
return true;
}
@@ -584,8 +570,7 @@ function write_config($desc="Unknown", $backup = true) {
conf_mount_ro();
config_unlock();
- generate_config_cache($config);
- cleanup_backupcache();
+ $config = parse_config(true);
return $config;
}
OpenPOWER on IntegriCloud