From 7169abc60f7e4593b4f41c6eb37604dd0d940fe4 Mon Sep 17 00:00:00 2001 From: Bartek Fabiszewski Date: Fri, 22 May 2020 22:34:38 +0200 Subject: [PATCH] Check if uploads folder is writable --- lang/en.php | 1 + scripts/setup.php | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lang/en.php b/lang/en.php index ab47da7..6f6db4c 100644 --- a/lang/en.php +++ b/lang/en.php @@ -43,6 +43,7 @@ $langSetup["startbutton"] = "Press to start"; $langSetup["restartbutton"] = "Restart"; $langSetup["optionwarn"] = "PHP configuration option %s must be set to %s."; // substitutes option name and value $langSetup["extensionwarn"] = "Required PHP extension %s is not available."; // substitutes extension name +$langSetup["notwritable"] = "Folder '%s' must be writable by PHP."; // substitutes folder path // application strings diff --git a/scripts/setup.php b/scripts/setup.php index 2f2eafd..c769aa0 100644 --- a/scripts/setup.php +++ b/scripts/setup.php @@ -168,6 +168,12 @@ switch ($command) { $messages[] = "
"; break; } + if (!is_writable(ROOT_DIR . "/uploads")) { + $messages[] = sprintf($langSetup["notwritable"], ROOT_DIR . "/uploads"); + $messages[] = $langSetup["dorestart"]; + $messages[] = "
"; + break; + } try { $pdo = getPdo(); } catch (PDOException $e) { @@ -186,7 +192,7 @@ switch ($command) { $pdo = null; $dbName = uDb::getDbName($configDSN); $dbName = empty($dbName) ? '""' : "" . htmlentities($dbName) . ""; - $messages[] = sprintf($langSetup["scriptdesc"], "'$tPositions', '$tTracks', '$tUsers'", $dbName); + $messages[] = sprintf($langSetup["scriptdesc"], "'$tPositions', '$tTracks', '$tUsers', '$tConfig', '$tLayers'", $dbName); $messages[] = $langSetup["scriptdesc2"]; $messages[] = "
"; break;