Skip to content

Commit 9a98687

Browse files
committed
Move define and mkdir earlier in the script
1 parent 6eef0af commit 9a98687

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

install/install.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,14 @@
153153
swriteln($inst->lng(' Default values are in [brackets] and can be accepted with <ENTER>.'));
154154
swriteln($inst->lng(' Tap in "quit" (without the quotes) to stop the installer.'."\n\n"));
155155

156-
//** Check install dir is writable (probably not root or sudo)
157-
if(!is_writable(dirname('/usr/local/ispconfig'))){
158-
die("ERROR: Cannot write to the /usr/local/ispconfig directory. Are you root or sudo ?\n\n");
156+
//** Check log file is writable (probably not root or sudo)
157+
define('ISPC_LOG_FILE', $conf['ispconfig_log_dir'] . '/install.log');
158+
if(!is_writable(dirname(ISPC_LOG_FILE))){
159+
die("ERROR: Cannot write to the ".dirname(ISPC_LOG_FILE)." directory. Are you root or sudo ?\n\n");
160+
}
161+
162+
if(!is_dir($conf['ispconfig_log_dir'])) {
163+
mkdir($conf['ispconfig_log_dir'], 0755, true);
159164
}
160165

161166
//** Check for ISPConfig 2.x versions
@@ -302,11 +307,6 @@
302307
$inst->dbmaster = $inst->db;
303308
}
304309

305-
if(!is_dir($conf['ispconfig_log_dir'])) {
306-
mkdir($conf['ispconfig_log_dir'], 0755, true);
307-
}
308-
define('ISPC_LOG_FILE', $conf['ispconfig_log_dir'] . '/install.log');
309-
310310
//* Create the mysql database
311311
$inst->configure_database();
312312

0 commit comments

Comments
 (0)