1
0
mirror of https://github.com/flarum/core.git synced 2025-08-15 04:44:08 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Alexander Skvortsov
31a2f67462 Apply fixes from StyleCI
[ci skip] [skip ci]
2021-12-12 19:38:25 +00:00
Alexander Skvortsov
3da7d7d221 Add server metadata in writable paths errors 2021-12-12 14:38:08 -05:00

View File

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