Skip to content

Commit

Permalink
Merge pull request #143 from KentarouTakeda/setting-whether-to-output…
Browse files Browse the repository at this point in the history
…-the-initialization-log

Setting whether to output the initialization log
  • Loading branch information
mnapoli committed Dec 6, 2023
2 parents 2bff7e6 + cf92542 commit 4e4432e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/StorageDirectories.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function create()

$directories = array_filter($directories, static fn ($directory) => ! is_dir($directory));

if (count($directories) && defined('STDERR')) {
if (count($directories) && defined('STDERR') && !getenv('BREF_LARAVEL_OMIT_INITLOG')) {
fwrite(STDERR, 'Creating storage directories: ' . implode(', ', $directories) . PHP_EOL);
}

Expand Down
12 changes: 8 additions & 4 deletions src/bref-init.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@
$_SERVER['APP_CONFIG_CACHE'] = $_ENV['APP_CONFIG_CACHE'] = $newConfigCachePath;
putenv("APP_CONFIG_CACHE={$newConfigCachePath}");

fwrite(STDERR, "Running 'php artisan config:cache' to cache the Laravel configuration\n");

// 1>&2 redirects the output to STDERR to avoid messing up HTTP responses with FPM
passthru('php artisan config:cache 1>&2');
$outputDestination = '> /dev/null';
if (!getenv('BREF_LARAVEL_OMIT_INITLOG')) {
fwrite(STDERR, "Running 'php artisan config:cache' to cache the Laravel configuration\n");
// 1>&2 redirects the output to STDERR to avoid messing up HTTP responses with FPM
$outputDestination = '1>&2';
}

passthru("php artisan config:cache {$outputDestination}");
}
});

Expand Down

0 comments on commit 4e4432e

Please sign in to comment.