mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
MVC, config: add method to find backup filename (or false if not found)
needed for https://github.com/opnsense/plugins/issues/1720
This commit is contained in:
parent
5b7268bb17
commit
8f3c89642c
@ -559,6 +559,22 @@ class Config extends Singleton
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return backup file path if revision exists
|
||||
* @param $revision revision timestamp (e.g. 1583766095.9337)
|
||||
* @return bool|string filename when available or false when not found
|
||||
*/
|
||||
public function getBackupFilename($revision)
|
||||
{
|
||||
$tmp = (float)$revision;
|
||||
$bckfilename = dirname($this->config_file) . "/backup/config-{$tmp}.xml";
|
||||
if (is_file($bckfilename)) {
|
||||
return $bckfilename;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove old backups
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user