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
ae8d44fa
Commit
ae8d44fa
authored
Apr 24, 2015
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: remove globbing-related unlink_if_exists() usage
parent
1832a5a3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
21 deletions
+8
-21
config.lib.inc
src/etc/inc/config.lib.inc
+3
-2
upgrade_config.inc
src/etc/inc/upgrade_config.inc
+3
-2
util.inc
src/etc/inc/util.inc
+0
-15
firewall_shaper_wizards.php
src/www/firewall_shaper_wizards.php
+2
-2
No files found.
src/etc/inc/config.lib.inc
View file @
ae8d44fa
...
@@ -204,7 +204,7 @@ function write_config($desc = 'Unknown', $backup = true)
...
@@ -204,7 +204,7 @@ function write_config($desc = 'Unknown', $backup = true)
******/
******/
function
reset_factory_defaults
(
$sync
=
true
)
function
reset_factory_defaults
(
$sync
=
true
)
{
{
unlink_if_exists
(
'/conf/*'
.
$filename
);
mwexec
(
'/bin/rm -r /conf/*'
);
disable_security_checks
();
disable_security_checks
();
setup_serial_port
();
setup_serial_port
();
...
@@ -217,7 +217,8 @@ function reset_factory_defaults($sync = true)
...
@@ -217,7 +217,8 @@ function reset_factory_defaults($sync = true)
}
}
}
}
function
config_restore
(
$conffile
)
{
function
config_restore
(
$conffile
)
{
global
$config
,
$g
;
global
$config
,
$g
;
if
(
!
file_exists
(
$conffile
))
if
(
!
file_exists
(
$conffile
))
...
...
src/etc/inc/upgrade_config.inc
View file @
ae8d44fa
...
@@ -2025,9 +2025,10 @@ function upgrade_054_to_055() {
...
@@ -2025,9 +2025,10 @@ function upgrade_054_to_055() {
/* Let's save the RRD graphs after we run enable RRD graphing */
/* Let's save the RRD graphs after we run enable RRD graphing */
/* The function will restore the rrd.tgz so we will save it after */
/* The function will restore the rrd.tgz so we will save it after */
exec
(
"cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='
{
$rrddbpath
}
' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd"
);
exec
(
"cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='
{
$rrddbpath
}
' CF_CONF_PATH='/conf' /usr/local/etc/rc.backup_rrd"
);
unlink_if_exists
(
"/var/db/rrd/*.xml"
);
mwexec
(
'/bin/rm /var/db/rrd/*.xml'
);
if
(
file_exists
(
"/var/run/booting"
))
if
(
file_exists
(
"/var/run/booting"
))
{
echo
"Updating configuration..."
;
echo
"Updating configuration..."
;
}
}
}
function
upgrade_055_to_056
()
{
function
upgrade_055_to_056
()
{
...
...
src/etc/inc/util.inc
View file @
ae8d44fa
...
@@ -1034,21 +1034,6 @@ function mwexec_bg($command, $mute = false, $clearsigmask = false)
...
@@ -1034,21 +1034,6 @@ function mwexec_bg($command, $mute = false, $clearsigmask = false)
mwexec
(
"/usr/sbin/daemon -f
{
$command
}
"
,
$mute
,
$clearsigmask
);
mwexec
(
"/usr/sbin/daemon -f
{
$command
}
"
,
$mute
,
$clearsigmask
);
}
}
/* unlink a file or directory, if it exists */
function
unlink_if_exists
(
$fn
)
{
$to_do
=
glob
(
$fn
);
foreach
(
$to_do
as
$filename
)
{
if
(
is_dir
(
$filename
))
{
/* rmdir() is not recursive... */
mwexecf
(
'/bin/rm -r %s'
,
$filename
);
}
else
{
unlink
(
$filename
);
}
}
}
/* make a global alias table (for faster lookups) */
/* make a global alias table (for faster lookups) */
function
alias_make_table
(
$config
)
function
alias_make_table
(
$config
)
{
{
...
...
src/www/firewall_shaper_wizards.php
View file @
ae8d44fa
...
@@ -52,8 +52,8 @@ if ($_POST['apply']) {
...
@@ -52,8 +52,8 @@ if ($_POST['apply']) {
$savemsg
=
$retval
;
$savemsg
=
$retval
;
/* reset rrd queues */
/* reset rrd queues */
unlink_if_exists
(
"/var/db/rrd/*queuedrops.rrd"
);
mwexec
(
'/bin/rm /var/db/rrd/*queuedrops.rrd'
);
unlink_if_exists
(
"/var/db/rrd/*queues.rrd"
);
mwexec
(
'/bin/rm /var/db/rrd/*queues.rrd'
);
enable_rrd_graphing
();
enable_rrd_graphing
();
clear_subsystem_dirty
(
'shaper'
);
clear_subsystem_dirty
(
'shaper'
);
...
...
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