diff --git a/src/Install/Prerequisite/WritablePaths.php b/src/Install/Prerequisite/WritablePaths.php index 9c4357d19..6ff8a3320 100644 --- a/src/Install/Prerequisite/WritablePaths.php +++ b/src/Install/Prerequisite/WritablePaths.php @@ -28,8 +28,33 @@ class WritablePaths implements PrerequisiteInterface public function problems(): Collection { - return $this->getMissingPaths() + $problems = $this->getMissingPaths() ->concat($this->getNonWritablePaths()); + + if (!$problems->isEmpty()) { + return $problems->prepend($this->getServerInfo()); + } + + return $problems; + } + + private function getServerInfo(): array + { + return [ + 'title' => 'Server Metadata', + 'detail' => implode('
', [ + 'The following information might be useful for troubleshooting the errors below.', + 'Current User:' . get_current_user(), + 'Current File Permissions:', + $this->paths->map(function ($path) { + return " - $path: " . substr(sprintf('%o', fileperms($path)), -4); + })->implode('
'), + 'Current File Ownership:', + $this->paths->map(function ($path) { + return " - $path: " . posix_getpwuid(fileowner($path))['name'] .':'.posix_getgrgid(filegroup($path))['name']; + })->implode('
'), + ]), + ]; } private function getMissingPaths(): Collection