Skip to content

Commit 66b4f90

Browse files
author
pedro_morgan
committed
Made log file a constant, replaced with __FILE__
1 parent facccbd commit 66b4f90

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

install/install.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
//TODO: this is not there ????
6767
$conf['dist'] = $dist;
6868

69+
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
70+
6971
//****************************************************************************************************
7072
//** Installer Interface
7173
//****************************************************************************************************
@@ -74,12 +76,17 @@
7476
swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.'));
7577
swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n"));
7678

79+
if(!is_writable(ISPC_LOG_FILE)){
80+
die("ERROR: Cannot write to the log file '".ISPC_LOG_FILE."'. Are you root ?\n\n");
81+
}
82+
7783
//** Select the language
7884
$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
7985

8086
//** Select installation mode
8187
$install_mode = $inst->simple_query('Installation mode', array('Standard','Expert'), 'Standard');
8288

89+
8390
//** Get the hostname
8491
$tmp_out = array();
8592
exec('hostname -f', $tmp_out);

install/lib/install.lib.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ function swriteln($text = '') {
7878
}
7979

8080
function ilog($msg){
81-
$logfile = '/var/log/ispconfig_install.log';
82-
exec("echo `date` \"- [ISPConfig] - \"".$msg." >> ".$logfile);
81+
exec("echo `date` \"- [ISPConfig] - \"".$msg." >> ".ISPC_LOG_FILE);
8382
}
8483

8584
function error($msg){

install/lib/installer_base.lib.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,14 @@ public function configure_database()
142142
//* Load the database dump into the database, if database contains no tables
143143
$db_tables = $this->db->getTables();
144144
if(count($db_tables) > 0) {
145-
$this->error('Stopped: Database contains already some tables.');
145+
$this->error('Stopped: Database already contains some tables.');
146146
} else {
147147
if($cf['admin_password'] == '') {
148148
caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' '".$cf['database']."' < 'sql/ispconfig3.sql' &> /dev/null",
149-
$FILE, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
149+
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
150150
} else {
151151
caselog("mysql -h '".$cf['host']."' -u '".$cf['admin_user']."' -p'".$cf['admin_password']."' '".$cf['database']."' < 'sql/ispconfig3.sql' &> /dev/null",
152-
$FILE, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
152+
__FILE__, __LINE__, 'read in ispconfig3.sql', 'could not read in ispconfig3.sql');
153153
}
154154
$db_tables = $this->db->getTables();
155155
if(count($db_tables) == 0) {

0 commit comments

Comments
 (0)