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
6d04247d
Commit
6d04247d
authored
Mar 12, 2015
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup write
parent
79da3b7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
48 deletions
+0
-48
config.lib.inc
src/etc/inc/config.lib.inc
+0
-48
No files found.
src/etc/inc/config.lib.inc
View file @
6d04247d
...
@@ -432,56 +432,8 @@ function write_config($desc = 'Unknown', $backup = true)
...
@@ -432,56 +432,8 @@ function write_config($desc = 'Unknown', $backup = true)
/* sync carp entries to other firewalls */
/* sync carp entries to other firewalls */
carp_sync_client
();
carp_sync_client
();
return
$config
;
return
$config
;
$lockkey
=
lock
(
'config'
,
LOCK_EX
);
/* generate configuration XML */
$xmlconfig
=
dump_xml_config
(
$config
,
$g
[
'xml_rootobj'
]);
/* write new configuration */
if
(
!
safe_write_file
(
'/conf/config.xml'
,
$xmlconfig
,
false
))
{
log_error
(
gettext
(
"WARNING: Config contents could not be save. Could not open file!"
));
unlock
(
$lockkey
);
file_notice
(
'config.xml'
,
sprintf
(
"%s
\n
"
,
gettext
(
'Unable to open /conf/config.xml for writing in write_config()'
)));
return
-
1
;
}
cleanup_backupcache
(
true
);
/* re-read configuration */
/* NOTE: We assume that the file can be parsed since we wrote it. */
$config
=
parse_xml_config
(
$config_xml
,
$g
[
'xml_rootobj'
]);
if
(
$config
==
-
1
)
{
copy
(
$config_xml
,
$config_xml
.
'.bad'
);
$last_backup
=
discover_last_backup
();
if
(
$last_backup
)
{
restore_backup
(
"/conf/backup/
{
$last_backup
}
"
);
$config
=
parse_xml_config
(
$config_xml
,
$g
[
'xml_rootobj'
]);
if
(
file_exists
(
"/var/run/booting"
))
{
echo
"
\n\n
************** WARNING **************"
;
echo
"
\n\n
Configuration could not be validated. A previous configuration was restored.
\n
"
;
echo
"
\n
The failed configuration file has been saved as
{
$config_xml
}
.bad
\n\n
"
;
}
}
else
log_error
(
gettext
(
"Could not restore config.xml."
));
}
else
generate_config_cache
(
$config
);
unlock
(
$lockkey
);
unlink_if_exists
(
"/usr/local/pkg/pf/carp_sync_client.php"
);
/* sync carp entries to other firewalls */
carp_sync_client
();
if
(
is_dir
(
"/usr/local/pkg/write_config"
))
{
/* process packager manager custom rules */
run_plugins
(
"/usr/local/pkg/write_config/"
);
}
return
$config
;
}
}
/****f* config/reset_factory_defaults
/****f* config/reset_factory_defaults
...
...
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