mirror of
https://github.com/flarum/core.git
synced 2025-08-21 23:56:33 +02:00
Compare commits
2 Commits
dw/drop-bo
...
as/writabl
Author | SHA1 | Date | |
---|---|---|---|
|
31a2f67462 | ||
|
3da7d7d221 |
@@ -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