MyBB Community Forums

Full Version: Deleted /uploads folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Stupid me deleted the /uploads folder per accidence.. now my question is, is there any query I can run to delete all "links" to "fake" attachments? I think this will give problems when uploading attachments with the same attachment id..

So that there will be an attachment in another post as well etc etc..

Or is there anything else I could do?

Please don't forget to think about the avatars.

Thanks in advance.
In the ACP -> Attachments -> Search Orphans
Does that do anything?
Quote:MyBB Message
No orphan attachments were found.
Any other solutions?
Try this.
Only tested in small environment, not sure what it'll be like in proper environment. Make a backup of the attachments and users table before running file from mybb directory.

Deletes enteries from mybb_attachments if no local file found, deletes user table avatars if found to be like './uploads/avatars/%' where the end is not one of the current avatar files in the avatar directory.
I got this result:
Quote:Array ( [6] => post_15_11215247536.attach [7] => post_30_11218021097.attach [9] => post_30_11228502559.attach [10] => post_30_112285025510.attach [19] => post_8_113647231719.attach [20] => post_8_113647231720.attach [21] => post_8_113647231721.attach [22] => post_8_113647238022.attach [24] => post_448_1154776362.attach ) UPDATE mybb_users SET avatar = '', avatardimensions = '', avatartype = '' WHERE avatar LIKE './uploads/avatars/%' AND !( avatar LIKE './uploads/avatars/index.html' OR avatar LIKE './uploads/avatars/avatar_8.jpg' OR avatar LIKE './uploads/avatars/avatar_21.jpg' OR avatar LIKE './uploads/avatars/avatar_502.gif')

So, was it working? Toungue
The first set of data are the database enteries that were orphened.
I didn't make it user friendly but it seems to be working Toungue
Thanks mate. Big Grin