Skip to content

Commit 8f63574

Browse files
[12.x] Add “Storage Linked” to the about command (#54949)
* [12.x] Add “Storage Linked” to the `about` command * Style CI fixes * Style CI fix * formatting --------- Co-authored-by: Taylor Otwell <[email protected]>
1 parent b7ab1c7 commit 8f63574

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/Illuminate/Foundation/Console/AboutCommand.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ protected function gatherApplicationInformation()
165165

166166
$formatEnabledStatus = fn ($value) => $value ? '<fg=yellow;options=bold>ENABLED</>' : 'OFF';
167167
$formatCachedStatus = fn ($value) => $value ? '<fg=green;options=bold>CACHED</>' : '<fg=yellow;options=bold>NOT CACHED</>';
168+
$formatStorageLinkedStatus = fn ($value) => $value ? '<fg=green;options=bold>LINKED</>' : '<fg=yellow;options=bold>NOT LINKED</>';
168169

169170
static::addToSection('Environment', fn () => [
170171
'Application Name' => config('app.name'),
@@ -214,9 +215,30 @@ protected function gatherApplicationInformation()
214215
'Session' => config('session.driver'),
215216
]));
216217

218+
static::addToSection('Storage', fn () => [
219+
...$this->determineStoragePathLinkStatus($formatStorageLinkedStatus),
220+
]);
221+
217222
(new Collection(static::$customDataResolvers))->each->__invoke();
218223
}
219224

225+
/**
226+
* Determine storage symbolic links status.
227+
*
228+
* @param callable $formatStorageLinkedStatus
229+
* @return array<string,mixed>
230+
*/
231+
protected function determineStoragePathLinkStatus(callable $formatStorageLinkedStatus): array
232+
{
233+
return collect(config('filesystems.links', []))
234+
->mapWithKeys(function ($target, $link) use ($formatStorageLinkedStatus) {
235+
$path = Str::replace(public_path(), '', $link);
236+
237+
return [public_path($path) => static::format(file_exists($link), console: $formatStorageLinkedStatus)];
238+
})
239+
->toArray();
240+
}
241+
220242
/**
221243
* Determine whether the given directory has PHP files.
222244
*

0 commit comments

Comments
 (0)