PDA

View Full Version : Mass Delete Missing or corrupt Attachments from DB?


Gabe505
08-09-2012, 11:22 PM
I have some issues with my attachments. Our server was recently restored after a hack. In the process our attachments (stored in filesystem) were deleted. The records of these attachments are still in the database and is causing problems.

Is there a way to remove these records from the database so these errors can be resolved. At this point I can't rebuild my attachment thumbs due to the following error.

Processing: Attachment : 66764 (jpg)Error: Attachment Missing

I have thousands of missing attachment files. HELP POR FAVOR!

kh99
08-12-2012, 01:38 PM
You would need to write a php script to compare the existing attachment files to the entries in the database, and remove the database entries for the missing files. That would leave broken attachments in posts though.

Maybe another thing you could do is to create and image that says "Sorry, attachment is missing" then copy or (file system) link that to each missing file name (you'd probably also need some kind of script to do that for you).

Gabe505
08-12-2012, 08:01 PM
Thanks for the reply kh99, much appreciated!

I figured so, hope somebody can help out with that. I'm not a coder and never will be, just the unfortunate Vitim of a bad server move. :(

Gabe505
08-14-2012, 10:47 PM
nobody want to byte into this one? I can test things on my bu databases if needed.