mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 00:54:41 +00:00
services: refactor return values
Suggested by: @fabianfrz
This commit is contained in:
parent
f759d902dc
commit
aa19f4b1db
@ -2937,8 +2937,6 @@ function is_radvd_enabled() {
|
||||
|
||||
function service_control_start($name, $extras)
|
||||
{
|
||||
$msg = sprintf(gettext('%s has been started.'), htmlspecialchars($name));
|
||||
|
||||
if (!empty($extras['id'])) {
|
||||
$filter['id'] = $extras['id'];
|
||||
}
|
||||
@ -2947,6 +2945,7 @@ function service_control_start($name, $extras)
|
||||
if (!isset($service['name'])) {
|
||||
return sprintf(gettext("Could not start unknown service `%s'"), htmlspecialchars($name));
|
||||
}
|
||||
|
||||
if (isset($service['configd']['start'])) {
|
||||
foreach ($service['configd']['start'] as $cmd) {
|
||||
configd_run($cmd);
|
||||
@ -2966,15 +2965,14 @@ function service_control_start($name, $extras)
|
||||
mwexec($cmd);
|
||||
}
|
||||
} 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)
|
||||
{
|
||||
$msg = sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
|
||||
$filter = array();
|
||||
|
||||
if (!empty($extras['id'])) {
|
||||
@ -3005,13 +3003,11 @@ function service_control_stop($name, $extras)
|
||||
killbyname($service['name']);
|
||||
}
|
||||
|
||||
return $msg;
|
||||
return sprintf(gettext("%s has been stopped."), htmlspecialchars($name));
|
||||
}
|
||||
|
||||
function service_control_restart($name, $extras)
|
||||
{
|
||||
$msg = sprintf(gettext("%s has been restarted."), htmlspecialchars($name));
|
||||
|
||||
if (!empty($extras['id'])) {
|
||||
$filter['id'] = $extras['id'];
|
||||
}
|
||||
@ -3040,8 +3036,8 @@ function service_control_restart($name, $extras)
|
||||
mwexec($cmd);
|
||||
}
|
||||
} 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));
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user