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
261d487d
Commit
261d487d
authored
Mar 12, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add isValid public method on config class
parent
f1c11390
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
5 deletions
+14
-5
Config.php
src/opnsense/mvc/app/library/OPNsense/Core/Config.php
+14
-5
No files found.
src/opnsense/mvc/app/library/OPNsense/Core/Config.php
View file @
261d487d
...
...
@@ -59,7 +59,16 @@ class Config extends Singleton
* status field: valid config loaded
* @var bool
*/
private
$isValid
=
false
;
private
$statusIsValid
=
false
;
/**
* @return bool return (last known) status of this configuration
*/
public
function
isValid
()
{
return
$this
->
statusIsValid
;
}
/**
* serialize xml to array structure (backwards compatibility mode)
...
...
@@ -155,7 +164,7 @@ class Config extends Singleton
*/
private
function
checkvalid
()
{
if
(
!
$this
->
i
sValid
)
{
if
(
!
$this
->
statusI
sValid
)
{
throw
new
ConfigException
(
'no valid config loaded'
)
;
}
}
...
...
@@ -241,7 +250,7 @@ class Config extends Singleton
$this
->
simplexml
=
simplexml_import_dom
(
$this
->
configxml
);
restore_error_handler
();
$this
->
i
sValid
=
true
;
$this
->
statusI
sValid
=
true
;
}
/**
...
...
@@ -333,7 +342,7 @@ class Config extends Singleton
public
function
restoreBackup
(
$filename
)
{
if
(
$this
->
i
sValid
)
{
if
(
$this
->
statusI
sValid
)
{
// if current config is valid,
$configxml
=
$this
->
configxml
;
$simplexml
=
$this
->
simplexml
;
...
...
@@ -346,7 +355,7 @@ class Config extends Singleton
// copy / load failed, restore previous version
$this
->
configxml
=
$configxml
;
$this
->
simplexml
=
$simplexml
;
$this
->
i
sValid
=
true
;
$this
->
statusI
sValid
=
true
;
$this
->
save
(
null
,
true
);
}
}
else
{
...
...
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