Check if uploads folder is writable

This commit is contained in:
Bartek Fabiszewski 2020-05-22 22:34:38 +02:00
parent 5da3d73fd3
commit 7169abc60f
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -168,6 +168,12 @@ switch ($command) {
$messages[] = "<form method=\"post\" action=\"setup.php?lang=$language\"><button>{$langSetup["restartbutton"]}</button></form>";
break;
}
if (!is_writable(ROOT_DIR . "/uploads")) {
$messages[] = sprintf($langSetup["notwritable"], ROOT_DIR . "/uploads");
$messages[] = $langSetup["dorestart"];
$messages[] = "<form method=\"post\" action=\"setup.php?lang=$language\"><button>{$langSetup["restartbutton"]}</button></form>";
break;
}
try {
$pdo = getPdo();
} catch (PDOException $e) {
@ -186,7 +192,7 @@ switch ($command) {
$pdo = null;
$dbName = uDb::getDbName($configDSN);
$dbName = empty($dbName) ? '""' : "<b>" . htmlentities($dbName) . "</b>";
$messages[] = sprintf($langSetup["scriptdesc"], "'$tPositions', '$tTracks', '$tUsers'", $dbName);
$messages[] = sprintf($langSetup["scriptdesc"], "'$tPositions', '$tTracks', '$tUsers', '$tConfig', '$tLayers'", $dbName);
$messages[] = $langSetup["scriptdesc2"];
$messages[] = "<form method=\"post\" action=\"setup.php?lang=$language\"><input type=\"hidden\" name=\"command\" value=\"setup\"><button>{$langSetup["startbutton"]}</button></form>";
break;