News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Bulk deletion of empty messages/posts via database

Started by GL700Wing, May 14, 2021, 01:21:57 AM

Previous topic - Next topic

GL700Wing

A few months ago I converted a BBPress forum to SMF and because the previous WordPress forums/message boards allowed empty messages/posts there are now about 150 empty messages/posts in the SMF forum.

I know how to delete the empty messages/posts from the 'messages' table in the database and that I know that I would need to run some forum maintenance tasks after deleting them (eg, 'Find and repair any errors', 'Recount all forum totals and statistics', 'Recount all member post counts', etc) but I'm just wondering if there are any issues associated with this approach that I need to be aware of (I don't really want to have to delete all these messages one by one).
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

vbgamer45

Are any of posts one topic only? if so you could have an empty/broken topic you would need to remove as well from the smf_topics table
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Kindred

direct deletion in the database is not something we recommend doing...

doing that will throw off counters and connections in a number of locations.

if you activate the checkbox moderation, you should be able to remove topics by the bunch from the interface, which cleans up the deletion/connections.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

GL700Wing

Quote from: vbgamer45 on May 14, 2021, 07:42:46 AM
Are any of posts one topic only? if so you could have an empty/broken topic you would need to remove as well from the smf_topics table
I had thought of that (and also that the first message in a topic could be empty - the WP admins from years ago had a habit of deleting the content of messages they didn't approve of even after replies had been posted ...) and I'll run a query today to find out if there are any messages that are the first message in a topic.

Quote from: Kindred on May 14, 2021, 07:53:05 AM
direct deletion in the database is not something we recommend doing...

doing that will throw off counters and connections in a number of locations.
I know there are risks involved which is why I thought I would ask here first to find out if anyone else has done this. 

Also, I have a completely separate copy of the forum I can do some testing with and I can create a backup copy of its database before I start.

Quoteif you activate the checkbox moderation, you should be able to remove topics by the bunch from the interface, which cleans up the deletion/connections.
Unfortunately this would be a very time-consuming and tedious process - the forum has almost 3,800 topics and almost 31,000 messages and unless it is a one-message topic I only want to delete the empty messages.




If I can't find a way to delete these messages safely in bulk via the database I'll just delete them as I come across them when browsing the forum.
Life doesn't have to be perfect to be wonderful ...

Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

Advertisement: