mirror of
https://github.com/flarum/core.git
synced 2025-08-08 09:26:34 +02:00
Add server metadata in writable paths errors
This commit is contained in:
@@ -28,8 +28,33 @@ class WritablePaths implements PrerequisiteInterface
|
|||||||
|
|
||||||
public function problems(): Collection
|
public function problems(): Collection
|
||||||
{
|
{
|
||||||
return $this->getMissingPaths()
|
$problems = $this->getMissingPaths()
|
||||||
->concat($this->getNonWritablePaths());
|
->concat($this->getNonWritablePaths());
|
||||||
|
|
||||||
|
if (!$problems->isEmpty()) {
|
||||||
|
return $problems->prepend($this->getServerInfo());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $problems;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getServerInfo(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'title' => 'Server Metadata',
|
||||||
|
'detail' => implode('<br />', [
|
||||||
|
'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('<br />'),
|
||||||
|
'Current File Ownership:',
|
||||||
|
$this->paths->map(function ($path) {
|
||||||
|
return " - $path: " . posix_getpwuid(fileowner($path))['name'] .':'.posix_getgrgid(filegroup($path))['name'];
|
||||||
|
})->implode('<br />'),
|
||||||
|
]),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getMissingPaths(): Collection
|
private function getMissingPaths(): Collection
|
||||||
|
Reference in New Issue
Block a user