diff --git a/src/Illuminate/Foundation/Console/AboutCommand.php b/src/Illuminate/Foundation/Console/AboutCommand.php index b7d39b775c43..9452aaf87808 100644 --- a/src/Illuminate/Foundation/Console/AboutCommand.php +++ b/src/Illuminate/Foundation/Console/AboutCommand.php @@ -52,7 +52,6 @@ class AboutCommand extends Command /** * Create a new command instance. * - * @param \Illuminate\Support\Composer $composer * @return void */ public function __construct(Composer $composer) @@ -165,6 +164,7 @@ protected function gatherApplicationInformation() $formatEnabledStatus = fn ($value) => $value ? 'ENABLED' : 'OFF'; $formatCachedStatus = fn ($value) => $value ? 'CACHED' : 'NOT CACHED'; + $formatStorageLinkedStatus = fn ($value) => $value ? 'LINKED' : 'NOT LINKED'; static::addToSection('Environment', fn () => [ 'Application Name' => config('app.name'), @@ -214,14 +214,15 @@ protected function gatherApplicationInformation() 'Session' => config('session.driver'), ])); + static::addToSection('Storage', fn () => [ + ...$this->checkStoragePaths($formatStorageLinkedStatus), + ]); + (new Collection(static::$customDataResolvers))->each->__invoke(); } /** * Determine whether the given directory has PHP files. - * - * @param string $path - * @return bool */ protected function hasPhpFiles(string $path): bool { @@ -231,9 +232,7 @@ protected function hasPhpFiles(string $path): bool /** * Add additional data to the output of the "about" command. * - * @param string $section * @param callable|string|array $data - * @param string|null $value * @return void */ public static function add(string $section, $data, ?string $value = null) @@ -244,9 +243,7 @@ public static function add(string $section, $data, ?string $value = null) /** * Add additional data to the output of the "about" command. * - * @param string $section * @param callable|string|array $data - * @param string|null $value * @return void */ protected static function addToSection(string $section, $data, ?string $value = null) @@ -299,7 +296,6 @@ public static function format($value, ?Closure $console = null, ?Closure $json = /** * Format the given string for searching. * - * @param string $value * @return string */ protected function toSearchKeyword(string $value) @@ -318,4 +314,21 @@ public static function flushState() static::$customDataResolvers = []; } + + /** + * Check storage symbolic links status. + * + * @param callable $formatStorageLinkedStatus Formatter for link status + * @return array Array of paths and their link status + */ + protected function checkStoragePaths(callable $formatStorageLinkedStatus): array + { + return collect(config('filesystems.links', [])) + ->mapWithKeys(function ($target, $link) use ($formatStorageLinkedStatus) { + $path = Str::replace(public_path(), '', $link); + + return [public_path($path) => static::format(file_exists($link), console: $formatStorageLinkedStatus)]; + }) + ->toArray(); + } }