Skip to content

Commit e38d145

Browse files
author
jwarnier
committed
- setup and use $conf['ispconfig_log_dir'], somehow replacing ISPC_LOG_PATH/$conf['logpath']
- replace double-quotes with single-quotes whenever appropriate - fix indentation
1 parent 47f5e03 commit e38d145

File tree

12 files changed

+367
-339
lines changed

12 files changed

+367
-339
lines changed

install/dist/lib/fedora.lib.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -889,8 +889,8 @@ public function install_ispconfig()
889889
// exec('chmod a+rx /usr/local/ispconfig/interface/web');
890890

891891
//* Create the ispconfig log directory
892-
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
893-
if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
892+
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
893+
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
894894

895895
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
896896
exec('chown getmail /usr/local/bin/run-getmail.sh');

install/dist/lib/gentoo.lib.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -752,11 +752,11 @@ public function install_ispconfig()
752752
}
753753

754754
// Create the ispconfig log directory
755-
if (!is_dir('/var/log/ispconfig')) {
756-
mkdir('/var/log/ispconfig');
755+
if (!is_dir($conf['ispconfig_log_dir'])) {
756+
mkdir($conf['ispconfig_log_dir']);
757757
}
758-
if (!is_file('/var/log/ispconfig/ispconfig.log')) {
759-
exec('touch /var/log/ispconfig/ispconfig.log');
758+
if (!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
759+
exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
760760
}
761761

762762
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
@@ -765,4 +765,4 @@ public function install_ispconfig()
765765
}
766766
}
767767

768-
?>
768+
?>

install/dist/lib/opensuse.lib.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -901,8 +901,8 @@ public function install_ispconfig()
901901
exec('chmod a+rx /usr/local/ispconfig/interface/web');
902902

903903
//* Create the ispconfig log directory
904-
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig');
905-
if(!is_file('/var/log/ispconfig/ispconfig.log')) exec('touch /var/log/ispconfig/ispconfig.log');
904+
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir']);
905+
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) exec('touch '.$conf['ispconfig_log_dir'].'/ispconfig.log');
906906

907907
exec('mv /usr/local/ispconfig/server/scripts/run-getmail.sh /usr/local/bin/run-getmail.sh');
908908
exec('chown getmail /usr/local/bin/run-getmail.sh');
@@ -992,4 +992,4 @@ public function install_crontab()
992992

993993
}
994994

995-
?>
995+
?>

install/lib/install.lib.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ function get_distname() {
9797
}
9898

9999
//** OpenSuSE
100-
elseif(file_exists("/etc/SuSE-release")) {
100+
elseif(file_exists('/etc/SuSE-release')) {
101101
if(stristr(file_get_contents('/etc/SuSE-release'),'11.0')) {
102102
$distname = 'openSUSE';
103103
$distver = '11.0';
@@ -127,7 +127,7 @@ function get_distname() {
127127

128128

129129
//** Redhat
130-
elseif(file_exists("/etc/redhat-release")) {
130+
elseif(file_exists('/etc/redhat-release')) {
131131

132132
$content = file_get_contents('/etc/redhat-release');
133133

@@ -171,7 +171,7 @@ function get_distname() {
171171
}
172172

173173
//** Gentoo
174-
elseif(file_exists("/etc/gentoo-release")) {
174+
elseif(file_exists('/etc/gentoo-release')) {
175175

176176
$content = file_get_contents('/etc/gentoo-release');
177177

@@ -183,7 +183,7 @@ function get_distname() {
183183
swriteln("Operating System: Gentoo $distver or compatible\n");
184184

185185
} else {
186-
die('unrecognized Linux distribution');
186+
die('Unrecognized GNU/Linux distribution');
187187
}
188188

189189
return array('name' => $distname, 'version' => $distver, 'id' => $distid, 'baseid' => $distbaseid);
@@ -203,7 +203,7 @@ function swriteln($text = '') {
203203
}
204204

205205
function ilog($msg){
206-
exec("echo `date` \"- [ISPConfig] - \"".$msg." >> ".ISPC_LOG_FILE);
206+
exec("echo `date` \"- [ISPConfig] - \"".$msg.' >> '.ISPC_LOG_FILE);
207207
}
208208

209209
function error($msg){
@@ -501,8 +501,8 @@ function is_user($user){
501501
$lines = explode("\n", $users);
502502
if(is_array($lines)){
503503
foreach($lines as $line){
504-
if(trim($line) != ""){
505-
list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(":", $line);
504+
if(trim($line) != ''){
505+
list($f1, $f2, $f3, $f4, $f5, $f6, $f7) = explode(':', $line);
506506
if($f1 == $user) return true;
507507
}
508508
}
@@ -517,8 +517,8 @@ function is_group($group){
517517
$lines = explode("\n", $groups);
518518
if(is_array($lines)){
519519
foreach($lines as $line){
520-
if(trim($line) != ""){
521-
list($f1, $f2, $f3, $f4) = explode(":", $line);
520+
if(trim($line) != ''){
521+
list($f1, $f2, $f3, $f4) = explode(':', $line);
522522
if($f1 == $group) return true;
523523
}
524524
}

install/lib/installer_base.lib.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ public function configure_apache() {
963963
global $conf;
964964

965965
//* Create the logging directory for the vhost logfiles
966-
mkdir('/var/log/ispconfig/httpd', 0755, true);
966+
mkdir($conf['ispconfig_log_dir'].'/httpd', 0755, true);
967967

968968
if(is_file('/etc/suphp/suphp.conf')) {
969969
replaceLine('/etc/suphp/suphp.conf','php=php:/usr/bin','x-httpd-suphp="php:/usr/bin/php-cgi"',0);
@@ -1470,10 +1470,10 @@ public function install_ispconfig() {
14701470
if(@is_file('/var/log/clamav/clamav.log')) exec('chmod +r /var/log/clamav/clamav.log');
14711471
if(@is_file('/var/log/clamav/freshclam.log')) exec('chmod +r /var/log/clamav/freshclam.log');
14721472

1473-
//* Create the ispconfig log directory
1474-
if(!is_file('/var/log/ispconfig/ispconfig.log')) {
1475-
if(!is_dir('/var/log/ispconfig')) mkdir('/var/log/ispconfig', 0755);
1476-
touch('/var/log/ispconfig/ispconfig.log');
1473+
//* Create the ispconfig log file and directory
1474+
if(!is_file($conf['ispconfig_log_dir'].'/ispconfig.log')) {
1475+
if(!is_dir($conf['ispconfig_log_dir'])) mkdir($conf['ispconfig_log_dir'], 0755);
1476+
touch($conf['ispconfig_log_dir'].'/ispconfig.log');
14771477
}
14781478

14791479
rename($install_dir.'/server/scripts/run-getmail.sh','/usr/local/bin/run-getmail.sh');
@@ -1486,14 +1486,14 @@ public function install_ispconfig() {
14861486
/* We rotate these logs in cron_daily.php
14871487
$fh = fopen('/etc/logrotate.d/logispc3', 'w');
14881488
fwrite($fh,
1489-
"/var/log/ispconfig/ispconfig.log { \n" .
1489+
"$conf['ispconfig_log_dir']/ispconfig.log { \n" .
14901490
" weekly \n" .
14911491
" missingok \n" .
14921492
" rotate 4 \n" .
14931493
" compress \n" .
14941494
" delaycompress \n" .
14951495
"} \n" .
1496-
"/var/log/ispconfig/cron.log { \n" .
1496+
"$conf['ispconfig_log_dir']/cron.log { \n" .
14971497
" weekly \n" .
14981498
" missingok \n" .
14991499
" rotate 4 \n" .
@@ -1544,8 +1544,8 @@ public function install_crontab() {
15441544
}
15451545

15461546
$root_cron_jobs = array(
1547-
"* * * * * $install_dir/server/server.sh > /dev/null 2>> /var/log/ispconfig/cron.log",
1548-
"30 00 * * * $install_dir/server/cron_daily.sh > /dev/null 2>> /var/log/ispconfig/cron.log"
1547+
"* * * * * $install_dir/server/server.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log",
1548+
"30 00 * * * $install_dir/server/cron_daily.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log"
15491549
);
15501550
foreach($root_cron_jobs as $cron_job) {
15511551
if(!in_array($cron_job."\n", $existing_root_cron_jobs)) {
@@ -1563,7 +1563,7 @@ public function install_crontab() {
15631563
$existing_cron_jobs = file('crontab.txt');
15641564

15651565
$cron_jobs = array(
1566-
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> /var/log/ispconfig/cron.log'
1566+
'*/5 * * * * /usr/local/bin/run-getmail.sh > /dev/null 2>> $conf['ispconfig_log_dir']/cron.log'
15671567
);
15681568

15691569
// remove existing ispconfig cronjobs, in case the syntax has changed
@@ -1581,8 +1581,8 @@ public function install_crontab() {
15811581
unlink('crontab.txt');
15821582
}
15831583

1584-
touch('/var/log/ispconfig/cron.log');
1585-
chmod('/var/log/ispconfig/cron.log', 0666);
1584+
touch($conf['ispconfig_log_dir'].'/cron.log');
1585+
chmod($conf['ispconfig_log_dir'].'/cron.log', 0666);
15861586

15871587
}
15881588

install/tpl/config.inc.php.master

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,27 @@ define('ISPC_APP_VERSION', '3.0.3');
6060

6161

6262
//** Database
63-
$conf["db_type"] = 'mysql';
64-
$conf["db_host"] = '{mysql_server_host}';
65-
$conf["db_database"] = '{mysql_server_database}';
66-
$conf["db_user"] = '{mysql_server_ispconfig_user}';
67-
$conf["db_password"] = '{mysql_server_ispconfig_password}';
68-
$conf["db_charset"] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
63+
$conf['db_type'] = 'mysql';
64+
$conf['db_host'] = '{mysql_server_host}';
65+
$conf['db_database'] = '{mysql_server_database}';
66+
$conf['db_user'] = '{mysql_server_ispconfig_user}';
67+
$conf['db_password'] = '{mysql_server_ispconfig_password}';
68+
$conf['db_charset'] = 'utf8'; // same charset as html-charset - (HTML --> MYSQL: "utf-8" --> "utf8", "iso-8859-1" --> "latin1")
6969

70-
define("DB_TYPE",$conf["db_type"]);
71-
define("DB_HOST",$conf["db_host"]);
72-
define("DB_DATABASE",$conf["db_database"]);
73-
define("DB_USER",$conf["db_user"]);
74-
define("DB_PASSWORD",$conf["db_password"]);
75-
define("DB_CHARSET",$conf["db_charset"]);
70+
define('DB_TYPE',$conf['db_type']);
71+
define('DB_HOST',$conf['db_host']);
72+
define('DB_DATABASE',$conf['db_database']);
73+
define('DB_USER',$conf['db_user']);
74+
define('DB_PASSWORD',$conf['db_password']);
75+
define('DB_CHARSET',$conf['db_charset']);
7676

7777

7878
//** Database settings for the master DB. This setting is only used in multiserver setups
79-
$conf["dbmaster_type"] = 'mysql';
80-
$conf["dbmaster_host"] = '{mysql_master_server_host}';
81-
$conf["dbmaster_database"] = '{mysql_master_server_database}';
82-
$conf["dbmaster_user"] = '{mysql_master_server_ispconfig_user}';
83-
$conf["dbmaster_password"] = '{mysql_master_server_ispconfig_password}';
79+
$conf['dbmaster_type'] = 'mysql';
80+
$conf['dbmaster_host'] = '{mysql_master_server_host}';
81+
$conf['dbmaster_database'] = '{mysql_master_server_database}';
82+
$conf['dbmaster_user'] = '{mysql_master_server_ispconfig_user}';
83+
$conf['dbmaster_password'] = '{mysql_master_server_ispconfig_password}';
8484

8585

8686
//** Paths
@@ -91,27 +91,27 @@ define('ISPC_WEB_PATH', ISPC_ROOT_PATH.'/web');
9191
define('ISPC_THEMES_PATH', ISPC_ROOT_PATH.'/web/themes');
9292
define('ISPC_WEB_TEMP_PATH', ISPC_WEB_PATH.'/temp'); // Path for downloads, accessible via browser
9393
define('ISPC_CACHE_PATH', ISPC_ROOT_PATH.'/cache');
94-
define('ISPC_LOG_PATH', '/var/log/ispconfig');
94+
define('ISPC_LOG_PATH', $conf['ispconfig_log_dir']);
9595

9696
//** Paths (Do not change!)
97-
$conf["rootpath"] = substr(dirname(__FILE__),0,-4);
98-
$conf["fs_div"] = "/"; // File system separator, "\\" on Windows and "/"" on Linux and UNIX
99-
$conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes";
100-
$conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp";
101-
$conf["logpath"] = ISPC_LOG_PATH;
97+
$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
98+
$conf['fs_div'] = '/'; // File system separator, "\\" on Windows and "/" on Linux and UNIX
99+
$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
100+
$conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
101+
$conf['logpath'] = ISPC_LOG_PATH; // Actually just a copy of $conf['ispconfig_log_dir'], might be removed in a later version
102102

103-
define("FS_DIV",$conf["fs_div"]);
104-
define("SERVER_ROOT",$conf["rootpath"]);
105-
define("INCLUDE_ROOT",SERVER_ROOT.FS_DIV."lib");
106-
define("CLASSES_ROOT",INCLUDE_ROOT.FS_DIV."classes");
103+
define('FS_DIV',$conf['fs_div']);
104+
define('SERVER_ROOT',$conf['rootpath']);
105+
define('INCLUDE_ROOT',SERVER_ROOT.FS_DIV.'lib');
106+
define('CLASSES_ROOT',INCLUDE_ROOT.FS_DIV.'classes');
107107

108108

109109
//** Server
110110
$conf['app_title'] = ISPC_APP_TITLE;
111111
$conf['app_version'] = ISPC_APP_VERSION;
112112
$conf['app_link'] = 'http://www.ispconfig.org/';
113113
$conf['modules_available'] = 'dashboard,admin,mail,sites,monitor,client,dns,help';
114-
$conf["server_id"] = "{server_id}";
114+
$conf['server_id'] = '{server_id}';
115115

116116

117117
//** Interface
@@ -128,38 +128,38 @@ $conf['demo_mode'] = false;
128128

129129

130130
//** Logging
131-
$conf["log_file"] = $conf["logpath"].$conf["fs_div"]."ispconfig.log";
132-
$conf["log_priority"] = {ispconfig_log_priority}; // 0 = Debug, 1 = Warning, 2 = Error
131+
$conf['log_file'] = $conf['ispconfig_log_dir'].$conf['fs_div'].'ispconfig.log';
132+
$conf['log_priority'] = {ispconfig_log_priority}; // 0 = Debug, 1 = Warning, 2 = Error
133133

134134

135135
//** Allow software package installations
136136
$conf['software_updates_enabled'] = false;
137137

138138

139139
//** Themes
140-
$conf["theme"] = 'default';
141-
$conf["html_content_encoding"] = 'utf-8'; // example: utf-8, iso-8859-1, ...
142-
$conf["logo"] = 'themes/default/images/ispc_logo.png';
140+
$conf['theme'] = 'default';
141+
$conf['html_content_encoding'] = 'utf-8'; // example: utf-8, iso-8859-1, ...
142+
$conf['logo'] = 'themes/default/images/ispc_logo.png';
143143

144144

145145
//** Default Language
146-
$conf["language"] = '{language}';
147-
$conf["debug_language"] = false;
146+
$conf['language'] = '{language}';
147+
$conf['debug_language'] = false;
148148

149149

150150
//** Misc.
151-
$conf["interface_logout_url"] = ""; // example: http://www.domain.tld/
151+
$conf['interface_logout_url'] = ''; // example: http://www.domain.tld/
152152

153153

154154
//** Auto Load Modules
155-
$conf["start_db"] = true;
156-
$conf["start_session"] = true;
155+
$conf['start_db'] = true;
156+
$conf['start_session'] = true;
157157

158158

159159
//** Constants
160-
define("LOGLEVEL_DEBUG",0);
161-
define("LOGLEVEL_WARN",1);
162-
define("LOGLEVEL_ERROR",2);
160+
define('LOGLEVEL_DEBUG',0);
161+
define('LOGLEVEL_WARN',1);
162+
define('LOGLEVEL_ERROR',2);
163163

164164
//** include a local config-file if there is one
165165
//** IMPORTANT!!!

interface/lib/config.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282

8383
//** Paths (Do not change!)
8484
$conf['rootpath'] = substr(dirname(__FILE__),0,-4);
85-
$conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/"" on Linux and UNIX
85+
$conf['fs_div'] = '/'; // File system separator (divider), "\\" on Windows and "/" on Linux and UNIX
8686
$conf['classpath'] = $conf['rootpath'].$conf['fs_div'].'lib'.$conf['fs_div'].'classes';
8787
$conf['temppath'] = $conf['rootpath'].$conf['fs_div'].'temp';
8888

@@ -114,7 +114,7 @@
114114

115115

116116
//** Logging
117-
$conf['log_file'] = '/var/log/ispconfig/ispconfig.log';
117+
$conf['log_file'] = $conf['ispconfig_log_dir'].'/ispconfig.log';
118118
$conf['log_priority'] = 0; // 0 = Debug, 1 = Warning, 2 = Error
119119

120120

server/cron_daily.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ function setConfigVar( $filename, $varName, $varValue ) {
228228
#######################################################################################################
229229

230230
// rotate the ispconfig.log when it exceeds a size of 10 MB
231-
$logfile = '/var/log/ispconfig/ispconfig.log';
231+
$logfile = $conf['ispconfig_log_dir'].'/ispconfig.log';
232232
if(is_file($logfile) && filesize($logfile) > 10000000) {
233233
exec("gzip -c $logfile > $logfile.1.gz");
234234
exec("cat /dev/null > $logfile");
235235
}
236236

237237
// rotate the cron.log when it exceeds a size of 10 MB
238-
$logfile = '/var/log/ispconfig/cron.log';
238+
$logfile = $conf['ispconfig_log_dir'].'/cron.log';
239239
if(is_file($logfile) && filesize($logfile) > 10000000) {
240240
exec("gzip -c $logfile > $logfile.1.gz");
241241
exec("cat /dev/null > $logfile");

0 commit comments

Comments
 (0)