Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Simpler way to delete all hidden posts with dependants?

+1 vote
1,314 views
asked Aug 16, 2010 in Q2A Core by Scott
It seems that if you hide an answer that has comments, running the delete script in Admin>Stats doesn't delete it because the comments are not hidden (they never show because the answer is hidden).

Could this be improved perhaps, so that it will first delete all comments that are part of a hidden answer? Or, when you hide an answer it hides all its comments automatically to avoid this problem?


Also, slightly related: does reindexing all data remove junk words from the database? In other words, if someone posted "blablablablabla" then that 15-letter 'word' gets indexed. But if I've hidden and deleted the post, will reindexing start completely from scratch? There seems to be a lot of junk in the words table.

1 Answer

+1 vote
answered Aug 17, 2010 by gidgreen
You're right about how hiding/deleting currently works.

Unfortunately there's no simple way to make it work how you'd like. Your second suggestion (hiding comments when the answer is hidden) is easy to implement but problematic because it gives too much power to the answer's author (plus they couldn't reverse their action). Your first suggestion (deleting comments of hidden answers when running the script) makes sense but would require writing a custom bit of code to find all hidden answers, and hide their comments, before running the delete script.

On your related question, reindexing should indeed remove all words from the database that are no longer being used. After reindexing there should be no rows in the qa_words table with zero in all the 'count' columns.
...