Make RemoveStorageSymlinksAction able to delete broken symlinks #1323
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed that RemoveStorageSymlinksAction only deletes symlinks if they're not broken (= if they're pointnig to an existing directory). To verify this:
This PR changes the
symlinkExists()
function in DealsWithTenantSymlinks to returnis_link($link)
instead offile_exists($link) && is_link($link)
(check if the link exists instead of checking if it exists ands is valid). This change makes RemoveStorageSymlinksAction able to delete broken symlinks. Added a regression test for that ('removing the tenant symlinks works even if the symlinks are invalid' in ActionTest).This PR also moves the commented RemoveStorageSymlinks job in the TenancyServiceProvider stub from the TenantDeleted event's job pipeline to DeletingTenant -- before the commented RemoveTenantStorage listener. This is a bit better default, since deleting the symlinks before deleting the tenant storage makes more sense (though with the
symlinkExists()
change, the order shouldn't really matter).