Vanilla3 to Flarum - Clean up User Avatar Folder Structure #66
MrCaspan
started this conversation in
Show and tell
Replies: 1 comment 4 replies
-
Nice tip. Note the reason for the subfolders is an optimization for forums with millions of users, because storing that many files in a flat directory makes the read times too long. Randomly dropping them into 1K folders speeds it up considerably. Of course, if you only have a few thousand users, it's annoying I suppose if you're looking at it, but most folks never will. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If you are like me Vanilla was not our first forum software. We migrated from Vbullien to Vanilla and now to Flarum. I had an issue that there was files all over the place and in sub directories for avatars. For some reason Vanilla wants to make a sub folder for each user to upload their avatar in. The folder and the file have random names. It's very messy and no real reason I see for it. So after Migrating to Flarum I decided to make sure all my photos were in the root of the /assets/avatars/ folder as this is where Flarum stores its avatars. (Flarum uses [a-z][A-Z][0-9]{16}.ext for it's avatars. So time to do some clean up!
First copy over your
userpics
from Vanilla to Flarum into the/assets/avatars/
folderThen run the next command to move all the files to the root
Now all the avatars are in the
/assets/avatars
folder. Next I want to remove all the thumbnail version of all avatars. In Vanilla [n]=thumbnail [p]=profile photo (Larger) The Porter tool updated the Flarum users table to reference the p version so the n verison is not neededClean up directories
Now all my files are in the root of the
/assets/avatars
, Now it is time to update the database to remove any path that is before the file nameAvatars are cleaned up now and in one directory!
Beta Was this translation helpful? Give feedback.
All reactions