Skip to content

Conversation

@Jellyfrog
Copy link
Contributor

When having the error_reporting set to showing warnings, this avoids the warning "No such file or directory" if the file doesn't exist.

For example:

$ php artisan config:clear
unlink(/home/jellyfrog/code/librenms/bootstrap/cache/config.php): No such file or directory in /home/jellyfrog/code/librenms/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 308

   INFO  Configuration cache cleared successfully.

NOTE: This is not a 100% correct fix, in Linux you should check if you have write+execute permissions on the parent-folder, but since there is a try/catch-block and the @-suppression already, I believe it's a good enough middle ground. Let me know if you want the more correct fix instead.

This avoids the warning "No such file or directory" if the file doesn't exist.

```
$ php artisan config:clear
unlink(/home/jellyfrog/code/librenms/bootstrap/cache/config.php): No such file or directory in /home/jellyfrog/code/librenms/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php on line 308

   INFO  Configuration cache cleared successfully.
```
@taylorotwell taylorotwell merged commit 7be06d1 into laravel:12.x Jun 11, 2025
41 of 62 checks passed
@rodrigopedra
Copy link
Contributor

This should be reverted, as

php artisan storage:link --force

no longer works.

The added is_file() check by this PR returns false for a symlink, therefore any existing links are not deleted here:

if (is_link($link)) {
$this->laravel->make('files')->delete($link);
}

ping @taylorotwell @crynobone

I can't work on a PR right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants