Skip to content

Commit 47f5e03

Browse files
author
jwarnier
committed
Use $conf['init_scripts'] instead of calling /etc/init.d/* directly
1 parent ae81a2b commit 47f5e03

File tree

2 files changed

+20
-19
lines changed

2 files changed

+20
-19
lines changed

server/mods-available/dns_module.inc.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,17 @@ function process($tablename,$action,$data) {
117117
function restartBind($action = 'restart') {
118118
global $app;
119119

120-
$command = '';
121-
if(is_file('/etc/init.d/bind9')) {
122-
$command = '/etc/init.d/bind9';
120+
$daemon = '';
121+
if(is_file($conf['init_scripts'] . '/' . 'bind9')) {
122+
$daemon = 'bind9';
123123
} else {
124-
$command = '/etc/init.d/named';
124+
$daemon = 'named';
125125
}
126126

127127
if($action == 'restart') {
128-
exec($command.' restart');
128+
exec($conf['init_scripts'] . '/' . $daemon . ' restart');
129129
} else {
130-
exec($command.' reload');
130+
exec($conf['init_scripts'] . '/' . $daemon . ' reload');
131131
}
132132

133133
}
@@ -166,13 +166,14 @@ function restartPowerDNS($action = 'restart') {
166166
*/
167167
file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr',$options."\n");
168168

169-
if (is_file('/etc/init.d/powerdns')) {
170-
$command = '/etc/init.d/powerdns';
169+
daemon= '';
170+
if (is_file($conf['init_scripts'] . '/' . 'powerdns')) {
171+
$daemon = 'powerdns';
171172
} else {
172-
$command = '/etc/init.d/pdns';
173+
$daemon = 'pdns';
173174
}
174175

175-
exec($command.' restart');
176+
exec($conf['init_scripts'] . '/' . $daemon . ' restart');
176177

177178
// unset $tmps;
178179

server/mods-available/web_module.inc.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ class that contains the function functionname.
8383
*/
8484

8585
$app->modules->registerTableHook('web_domain','web_module','process');
86-
$app->modules->registerTableHook('ftp_user','web_module','process');
87-
$app->modules->registerTableHook('shell_user','web_module','process');
86+
$app->modules->registerTableHook('ftp_user','web_module','process');
87+
$app->modules->registerTableHook('shell_user','web_module','process');
8888
$app->modules->registerTableHook('webdav_user','web_module','process');
8989

9090
// Register service
@@ -129,21 +129,21 @@ function process($tablename,$action,$data) {
129129
function restartHttpd($action = 'restart') {
130130
global $app;
131131

132-
$command = '';
133-
if(is_file('/etc/init.d/httpd')) {
134-
$command = '/etc/init.d/httpd';
132+
$daemon = '';
133+
if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
134+
$daemon = 'httpd';
135135
} else {
136-
$command = '/etc/init.d/apache2';
136+
$daemon = 'apache2';
137137
}
138138

139139
if($action == 'restart') {
140-
exec($command.' restart');
140+
exec($conf['init_scripts'] . '/' . $daemon . ' restart');
141141
} else {
142-
exec($command.' reload');
142+
exec($conf['init_scripts'] . '/' . $daemon . ' reload');
143143
}
144144

145145
}
146146

147147
} // end class
148148

149-
?>
149+
?>

0 commit comments

Comments
 (0)