Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5c512f6

Browse files
committed
bug #50665 [FrameworkBundle] Ignore missing directories in about command (ro0NL)
This PR was merged into the 5.4 branch. Discussion ---------- [FrameworkBundle] Ignore missing directories in about command | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes IMHO | New feature? | no | Deprecations? | no | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> This fixes our CI when `var/log` is missing. Before: ``` In AboutCommand.php line 105: [UnexpectedValueException] RecursiveDirectoryIterator::__construct(/app/var/log): Failed to open directory: No such file or directory ``` After: ``` Cache directory ./var/cache/prod (939 KiB) Build directory ./var/cache/prod (939 KiB) Log directory ./var/log (n/a) ``` Commits ------- 6dacc59 [FrameworkBundle] Ignore missing directories in about command
2 parents 46cda10 + 6dacc59 commit 5c512f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/AboutCommand.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ private static function formatFileSize(string $path): string
109109
if (is_file($path)) {
110110
$size = filesize($path) ?: 0;
111111
} else {
112+
if (!is_dir($path)) {
113+
return 'n/a';
114+
}
115+
112116
$size = 0;
113117
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS | \RecursiveDirectoryIterator::FOLLOW_SYMLINKS)) as $file) {
114118
if ($file->isReadable()) {

0 commit comments

Comments
 (0)