Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
24 stars 19 forks source link

Comment Deleting Issues #1123

Closed eSilverStrike closed 2 years ago

eSilverStrike commented 2 years ago

Issue 1

I am working on #1029 and I notice that not all data stored about comments is deleted by CMT_deleteComment. It needs to delete the comment data from the tables commentnotifications and commentedits as well.

Issue 2

I also notice when a plugin item like an article or staticpage is deleted it deletes the data directly from the comments table and that is it. This should not happen as a lot of things need to be done during a comment delete (see CMT_deleteComment).

Also in some cases comment submissions are not deleted for the plugin item.

Solution A A function needs to be created that can be called by the article library, staticpage plugin, etc.. that will allow all comments for a specific type and item to be deleted. Then all plugins that have comments will need to be updated to use this function.

OR

Solution B another way to handle this maybe is since plugins should support PLG_itemDeleted we can create a function plugin_itemdeleted_comment that can just auto try to delete comments properly even if they do get deleted directly from the table by the other plugin. This solution could have issues if PLG_itemDeleted is not supported. Plus it would get called anytime something is deleted even if the item being deleted doesn't have comments

Issue 3

PLG_uninstall also just deletes comments table and nothing else on plugin uninstall. This needs to be fixed as well (likes also has an issue here as well).

Issue 4

On upgrade the database should scrub the tables commentnotifications and commentedits and remove any records that do not have an actual comment record anymore. commentsubmissions table should also be checked and orphan records deleted.

eSilverStrike commented 2 years ago

CMT_deleteComment now required to be used when deleting comments. CMT_deleteComment is now used by articles, polls, and staticpages.

Plugin Uninstall now uses:

For user delete added likes and comments to PLG_deleteUser so all records get handled correctly including submissions

Updated Links and Events to delete any submissions if user deleted.

Issue 4 still needs to be fixed.