prepare public symlink
This commit is contained in:
@@ -63,10 +63,31 @@ class SystemStatusController extends Controller
|
||||
'rsync_version' => $this->resolveBinaryVersion($rsyncPath, ['--version']),
|
||||
'proc_functions' => $procFunctionStatus,
|
||||
'storage_writable' => is_writable(storage_path()),
|
||||
'storage_public_linked' => $this->isPublicStorageLinked(),
|
||||
'updates_writable' => is_writable(storage_path('app/updates')) || @mkdir(storage_path('app/updates'), 0755, true),
|
||||
]);
|
||||
}
|
||||
|
||||
private function isPublicStorageLinked(): bool
|
||||
{
|
||||
$publicStorage = public_path('storage');
|
||||
$storagePublic = storage_path('app/public');
|
||||
|
||||
if (!is_link($publicStorage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$target = readlink($publicStorage);
|
||||
if ($target === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$resolvedTarget = realpath(dirname($publicStorage) . DIRECTORY_SEPARATOR . $target);
|
||||
$expectedTarget = realpath($storagePublic);
|
||||
|
||||
return $resolvedTarget !== false && $expectedTarget !== false && $resolvedTarget === $expectedTarget;
|
||||
}
|
||||
|
||||
private function resolveBinary(string $name): ?string
|
||||
{
|
||||
$process = new Process(['sh', '-lc', "command -v {$name}"]);
|
||||
|
||||
Reference in New Issue
Block a user