small fixes in config

This commit is contained in:
Ad Schellevis 2015-03-12 11:31:25 +01:00
parent 264c28d1e3
commit 5114af5368

View File

@ -230,7 +230,11 @@ class Config extends Singleton
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->loadXML($xml);
@ -265,9 +269,11 @@ class Config extends Singleton
$target_dir = dirname($this->config_file)."/backup/";
$target_filename = "config-".time().".xml";
if (file_exists($target_dir)) {
copy($this->config_file, $target_dir.$target_filename);
if (!file_exists($target_dir)) {
// create backup directory if it's missing
mkdir($target_dir);
}
copy($this->config_file, $target_dir.$target_filename);
}