show update steps for version updates (forgot that once or twice); add fallback for file deletion if exec() is not allowed; fix php7.4 warnings

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-10-08 10:54:08 +02:00
parent 8f850ee7f3
commit 466ea0fa99
3 changed files with 18 additions and 4 deletions

View File

@@ -265,6 +265,7 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201904100')) {
} }
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.0-rc1')) { if (\Froxlor\Froxlor::isFroxlorVersion('0.10.0-rc1')) {
showUpdateStep("Updating from 0.10.0-rc1 to 0.10.0-rc2", false);
\Froxlor\Froxlor::updateToVersion('0.10.0-rc2'); \Froxlor\Froxlor::updateToVersion('0.10.0-rc2');
} }
@@ -302,18 +303,31 @@ if (\Froxlor\Froxlor::isDatabaseVersion('201907270')) {
"templates/Sparkle/admin/tickets", "templates/Sparkle/admin/tickets",
"templates/Sparkle/customer/tickets" "templates/Sparkle/customer/tickets"
); );
$disabled = explode(',', ini_get('disable_functions'));
$exec_allowed = !in_array('exec', $disabled);
$del_list = "";
foreach ($to_clean as $filedir) { foreach ($to_clean as $filedir) {
$complete_filedir = \Froxlor\Froxlor::getInstallDir() . $filedir; $complete_filedir = \Froxlor\Froxlor::getInstallDir() . $filedir;
if (file_exists($complete_filedir)) { if (file_exists($complete_filedir)) {
Froxlor\FileDir::safe_exec("rm -rf " . escapeshellarg($complete_filedir)); if ($exec_allowed) {
Froxlor\FileDir::safe_exec("rm -rf " . escapeshellarg($complete_filedir));
} else {
$del_list .= "rm -rf " . escapeshellarg($complete_filedir) . PHP_EOL;
}
} }
} }
lastStepStatus(0); if ($exec_allowed) {
lastStepStatus(0);
} else {
lastStepStatus(1, 'manual commands needed');
echo '<span class="update-step update-step-err">Please run the following commands manually:</span><br><pre>'.$del_list.'</pre><br>';
}
\Froxlor\Froxlor::updateToDbVersion('201909150'); \Froxlor\Froxlor::updateToDbVersion('201909150');
} }
if (\Froxlor\Froxlor::isFroxlorVersion('0.10.0-rc2')) { if (\Froxlor\Froxlor::isFroxlorVersion('0.10.0-rc2')) {
showUpdateStep("Updating from 0.10.0-rc2 to 0.10.0 final", false);
\Froxlor\Froxlor::updateToVersion('0.10.0'); \Froxlor\Froxlor::updateToVersion('0.10.0');
} }

View File

@@ -191,7 +191,7 @@ class ConfigIO
/** /**
* don't do anything if the file does not exist * don't do anything if the file does not exist
*/ */
if (@file_exists($awstatsclean['fullentry'])) { if (@file_exists($awstatsclean['fullentry']) && $awstatsclean['entry'] != '.' && $awstatsclean['entry'] != '..') {
$awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r'); $awstatsclean['fh'] = fopen($awstatsclean['fullentry'], 'r');
$awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header']) + 1); $awstatsclean['headerRead'] = fgets($awstatsclean['fh'], strlen($awstatsclean['header']) + 1);
fclose($awstatsclean['fh']); fclose($awstatsclean['fh']);

View File

@@ -133,7 +133,7 @@ class HttpConfigBase
"); ");
$ssldestport = Database::pexecute_first($ssldestport_stmt); $ssldestport = Database::pexecute_first($ssldestport_stmt);
if ($ssldestport['port'] != '') { if ($ssldestport && $ssldestport['port'] != '') {
$_sslport = ":" . $ssldestport['port']; $_sslport = ":" . $ssldestport['port'];
} }