Commit 5114af53 authored by Ad Schellevis's avatar Ad Schellevis

small fixes in config

parent 264c28d1
...@@ -230,7 +230,11 @@ class Config extends Singleton ...@@ -230,7 +230,11 @@ class Config extends Singleton
throw new ConfigException('empty file') ; throw new ConfigException('empty file') ;
} }
set_error_handler(function(){throw new ConfigException("invalid config xml") ;}) ; set_error_handler(
function() {
throw new ConfigException("invalid config xml") ;
}
);
$this->configxml = new \DOMDocument('1.0'); $this->configxml = new \DOMDocument('1.0');
$this->configxml->loadXML($xml); $this->configxml->loadXML($xml);
...@@ -265,9 +269,11 @@ class Config extends Singleton ...@@ -265,9 +269,11 @@ class Config extends Singleton
$target_dir = dirname($this->config_file)."/backup/"; $target_dir = dirname($this->config_file)."/backup/";
$target_filename = "config-".time().".xml"; $target_filename = "config-".time().".xml";
if (file_exists($target_dir)) { if (!file_exists($target_dir)) {
copy($this->config_file, $target_dir.$target_filename); // create backup directory if it's missing
mkdir($target_dir);
} }
copy($this->config_file, $target_dir.$target_filename);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment