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
39d08e57
Commit
39d08e57
authored
May 17, 2016
by
Franco Fichtner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
services: refactor return values
Suggested by: @fabianfrz (cherry picked from commit
aa19f4b1
)
parent
7d568ea2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
services.inc
src/etc/inc/services.inc
+6
-10
No files found.
src/etc/inc/services.inc
View file @
39d08e57
...
@@ -2927,8 +2927,6 @@ function is_radvd_enabled() {
...
@@ -2927,8 +2927,6 @@ function is_radvd_enabled() {
function
service_control_start
(
$name
,
$extras
)
function
service_control_start
(
$name
,
$extras
)
{
{
$msg
=
sprintf
(
gettext
(
'%s has been started.'
),
htmlspecialchars
(
$name
));
if
(
!
empty
(
$extras
[
'id'
]))
{
if
(
!
empty
(
$extras
[
'id'
]))
{
$filter
[
'id'
]
=
$extras
[
'id'
];
$filter
[
'id'
]
=
$extras
[
'id'
];
}
}
...
@@ -2937,6 +2935,7 @@ function service_control_start($name, $extras)
...
@@ -2937,6 +2935,7 @@ function service_control_start($name, $extras)
if
(
!
isset
(
$service
[
'name'
]))
{
if
(
!
isset
(
$service
[
'name'
]))
{
return
sprintf
(
gettext
(
"Could not start unknown service `%s'"
),
htmlspecialchars
(
$name
));
return
sprintf
(
gettext
(
"Could not start unknown service `%s'"
),
htmlspecialchars
(
$name
));
}
}
if
(
isset
(
$service
[
'configd'
][
'start'
]))
{
if
(
isset
(
$service
[
'configd'
][
'start'
]))
{
foreach
(
$service
[
'configd'
][
'start'
]
as
$cmd
)
{
foreach
(
$service
[
'configd'
][
'start'
]
as
$cmd
)
{
configd_run
(
$cmd
);
configd_run
(
$cmd
);
...
@@ -2956,15 +2955,14 @@ function service_control_start($name, $extras)
...
@@ -2956,15 +2955,14 @@ function service_control_start($name, $extras)
mwexec
(
$cmd
);
mwexec
(
$cmd
);
}
}
}
else
{
}
else
{
$msg
=
sprintf
(
gettext
(
"Could not start service `%s'"
),
htmlspecialchars
(
$name
));
return
sprintf
(
gettext
(
"Could not start service `%s'"
),
htmlspecialchars
(
$name
));
}
}
return
$msg
;
return
sprintf
(
gettext
(
'%s has been started.'
),
htmlspecialchars
(
$name
))
;
}
}
function
service_control_stop
(
$name
,
$extras
)
function
service_control_stop
(
$name
,
$extras
)
{
{
$msg
=
sprintf
(
gettext
(
"%s has been stopped."
),
htmlspecialchars
(
$name
));
$filter
=
array
();
$filter
=
array
();
if
(
!
empty
(
$extras
[
'id'
]))
{
if
(
!
empty
(
$extras
[
'id'
]))
{
...
@@ -2995,13 +2993,11 @@ function service_control_stop($name, $extras)
...
@@ -2995,13 +2993,11 @@ function service_control_stop($name, $extras)
killbyname
(
$service
[
'name'
]);
killbyname
(
$service
[
'name'
]);
}
}
return
$msg
;
return
sprintf
(
gettext
(
"%s has been stopped."
),
htmlspecialchars
(
$name
))
;
}
}
function
service_control_restart
(
$name
,
$extras
)
function
service_control_restart
(
$name
,
$extras
)
{
{
$msg
=
sprintf
(
gettext
(
"%s has been restarted."
),
htmlspecialchars
(
$name
));
if
(
!
empty
(
$extras
[
'id'
]))
{
if
(
!
empty
(
$extras
[
'id'
]))
{
$filter
[
'id'
]
=
$extras
[
'id'
];
$filter
[
'id'
]
=
$extras
[
'id'
];
}
}
...
@@ -3030,8 +3026,8 @@ function service_control_restart($name, $extras)
...
@@ -3030,8 +3026,8 @@ function service_control_restart($name, $extras)
mwexec
(
$cmd
);
mwexec
(
$cmd
);
}
}
}
else
{
}
else
{
$msg
=
sprintf
(
gettext
(
"Could not restart service `%s'"
),
htmlspecialchars
(
$name
));
return
sprintf
(
gettext
(
"Could not restart service `%s'"
),
htmlspecialchars
(
$name
));
}
}
return
$msg
;
return
sprintf
(
gettext
(
"%s has been restarted."
),
htmlspecialchars
(
$name
))
;
}
}
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