Commit 55bdb356 authored by Ad Schellevis's avatar Ad Schellevis

sync master

parent 3d65e9fa
...@@ -319,15 +319,30 @@ class Config extends Singleton ...@@ -319,15 +319,30 @@ class Config extends Singleton
/** /**
* return list of config backups * return list of config backups
* @param bool $fetchRevisionInfo fetch revision information and return detailed information. (key/value)
* @return array list of backups * @return array list of backups
*/ */
public function getBackups() public function getBackups($fetchRevisionInfo = false)
{ {
$target_dir = dirname($this->config_file)."/backup/"; $target_dir = dirname($this->config_file)."/backup/";
if (file_exists($target_dir)) { if (file_exists($target_dir)) {
$backups = glob($target_dir."config*.xml"); $backups = glob($target_dir."config*.xml");
// sort by date (descending)
rsort($backups); rsort($backups);
if (!$fetchRevisionInfo) {
return $backups; return $backups;
} else {
$result = array ();
foreach ($backups as $filename) {
// try to read backup info from xml
$xmlNode = simplexml_load_file($filename, "SimpleXMLElement", LIBXML_NOERROR | LIBXML_ERR_NONE);
if (isset($xmlNode->revision)) {
$result[$filename] = $this->toArray($xmlNode->revision);
}
}
return $result;
}
} }
return array(); return array();
......
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