From 47f5e03bbf38d54922a9c397d4f2770994a03921 Mon Sep 17 00:00:00 2001
From: jwarnier <jwarnier@ispconfig3>
Date: Fri, 24 Sep 2010 21:22:05 -0400
Subject: [PATCH] Use $conf['init_scripts'] instead of calling /etc/init.d/* directly
---
server/mods-available/dns_module.inc.php | 21 +++++++++++----------
server/mods-available/web_module.inc.php | 18 +++++++++---------
2 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/server/mods-available/dns_module.inc.php b/server/mods-available/dns_module.inc.php
index f079127..4ea5d09 100644
--- a/server/mods-available/dns_module.inc.php
+++ b/server/mods-available/dns_module.inc.php
@@ -117,17 +117,17 @@
function restartBind($action = 'restart') {
global $app;
- $command = '';
- if(is_file('/etc/init.d/bind9')) {
- $command = '/etc/init.d/bind9';
+ $daemon = '';
+ if(is_file($conf['init_scripts'] . '/' . 'bind9')) {
+ $daemon = 'bind9';
} else {
- $command = '/etc/init.d/named';
+ $daemon = 'named';
}
if($action == 'restart') {
- exec($command.' restart');
+ exec($conf['init_scripts'] . '/' . $daemon . ' restart');
} else {
- exec($command.' reload');
+ exec($conf['init_scripts'] . '/' . $daemon . ' reload');
}
}
@@ -166,13 +166,14 @@
*/
file_put_contents('/etc/powerdns/pdns.d/pdns.ispconfig-axfr',$options."\n");
- if (is_file('/etc/init.d/powerdns')) {
- $command = '/etc/init.d/powerdns';
+ daemon= '';
+ if (is_file($conf['init_scripts'] . '/' . 'powerdns')) {
+ $daemon = 'powerdns';
} else {
- $command = '/etc/init.d/pdns';
+ $daemon = 'pdns';
}
- exec($command.' restart');
+ exec($conf['init_scripts'] . '/' . $daemon . ' restart');
// unset $tmps;
diff --git a/server/mods-available/web_module.inc.php b/server/mods-available/web_module.inc.php
index eeae092..1ec10be 100644
--- a/server/mods-available/web_module.inc.php
+++ b/server/mods-available/web_module.inc.php
@@ -83,8 +83,8 @@
*/
$app->modules->registerTableHook('web_domain','web_module','process');
- $app->modules->registerTableHook('ftp_user','web_module','process');
- $app->modules->registerTableHook('shell_user','web_module','process');
+ $app->modules->registerTableHook('ftp_user','web_module','process');
+ $app->modules->registerTableHook('shell_user','web_module','process');
$app->modules->registerTableHook('webdav_user','web_module','process');
// Register service
@@ -129,21 +129,21 @@
function restartHttpd($action = 'restart') {
global $app;
- $command = '';
- if(is_file('/etc/init.d/httpd')) {
- $command = '/etc/init.d/httpd';
+ $daemon = '';
+ if(is_file($conf['init_scripts'] . '/' . 'httpd')) {
+ $daemon = 'httpd';
} else {
- $command = '/etc/init.d/apache2';
+ $daemon = 'apache2';
}
if($action == 'restart') {
- exec($command.' restart');
+ exec($conf['init_scripts'] . '/' . $daemon . ' restart');
} else {
- exec($command.' reload');
+ exec($conf['init_scripts'] . '/' . $daemon . ' reload');
}
}
} // end class
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1