Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
da2c3c1b
Commit
da2c3c1b
authored
Mar 13, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add revisiondata to getBackups for config class
parent
6a2f32dc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
Config.php
src/opnsense/mvc/app/library/OPNsense/Core/Config.php
+17
-2
No files found.
src/opnsense/mvc/app/library/OPNsense/Core/Config.php
View file @
da2c3c1b
...
...
@@ -319,15 +319,30 @@ class Config extends Singleton
/**
* return list of config backups
* @param bool $fetchRevisionInfo fetch revision information and return detailed information. (key/value)
* @return array list of backups
*/
public
function
getBackups
()
public
function
getBackups
(
$fetchRevisionInfo
=
false
)
{
$target_dir
=
dirname
(
$this
->
config_file
)
.
"/backup/"
;
if
(
file_exists
(
$target_dir
))
{
$backups
=
glob
(
$target_dir
.
"config*.xml"
);
// sort by date (descending)
rsort
(
$backups
);
return
$backups
;
if
(
!
$fetchRevisionInfo
)
{
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
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment