Commit 1777032
authored
fix(user): delete avatar file from disk when user account is deleted (#4485)
AvatarUploader::remove() was never called during user deletion, leaving
avatar files as orphans on the flarum-avatars disk. Every deleted user
with a custom avatar accumulated a stranded file indefinitely.
Hook into the existing deleting observer (pre-delete, so the avatar_url
attribute is still readable) and delete the file directly from the
filesystem. Uses getRawOriginal() to get the stored path rather than
the accessor, which would return a full URL.
Fixes #44591 parent 30943d7 commit 1777032
1 file changed
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
154 | 164 | | |
155 | 165 | | |
156 | 166 | | |
| |||
0 commit comments