diff --git a/Core/Documents/Install.class.php b/Core/Documents/Install.class.php
index cfa8c22..f63759e 100644
--- a/Core/Documents/Install.class.php
+++ b/Core/Documents/Install.class.php
@@ -235,11 +235,31 @@ namespace Documents\Install {
$success = true;
$failedRequirements = array();
- // TODO: rather give a list of directories which have to be writable
- // this should be: /Site/Cache, /Site/Logs, /Core/External/vendor, /react/dist/
- // also likely: /react and /Site/API for cli.php
- if (!is_writeable(WEBROOT)) {
- $failedRequirements[] = sprintf("%s is not writeable. Try running chmod 700 %s", WEBROOT, WEBROOT);
+ $requiredDirectories = [
+ "/Site/Cache",
+ "/Site/Logs",
+ "/Site/Configuration",
+ "/Core/External/vendor",
+ "/files/uploaded",
+ ];
+
+ $nonWritableDirectories = [];
+ foreach ($requiredDirectories as $directory) {
+ if (!is_writeable(WEBROOT . $directory)) {
+ $nonWritableDirectories[] = $directory;
+ }
+ }
+
+ if (!empty($nonWritableDirectories)) {
+ $currentUser = getCurrentUsername();
+ if (function_exists("posix_getuid")) {
+ $currentUser .= " (uid: " . posix_getuid() . ")";
+ }
+
+ $failedRequirements[] = "One or more directories are not writable. " .
+ "Make sure the current user $currentUser has write-access to following locations:" .
+ $this->createUnorderedList($nonWritableDirectories);
+
$success = false;
}
diff --git a/Core/core.php b/Core/core.php
index 781e7b2..86cb061 100644
--- a/Core/core.php
+++ b/Core/core.php
@@ -298,6 +298,14 @@ function isClass(string $str): bool {
return is_file($path) && class_exists($str);
}
+function getCurrentUsername(): string {
+ if (function_exists("posix_getpwuid") && function_exists("posix_geteuid")) {
+ return posix_getpwuid(posix_geteuid())['name'];
+ }
+
+ return exec('whoami') ?? "Unknown";
+}
+
function rrmdir(string $dir): void {
if (is_dir($dir)) {
$objects = scandir($dir);