Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle orphaned data in comment db table #4446

Open
indigoxela opened this issue Jun 19, 2020 · 1 comment
Open

Properly handle orphaned data in comment db table #4446

indigoxela opened this issue Jun 19, 2020 · 1 comment

Comments

@indigoxela
Copy link
Member

indigoxela commented Jun 19, 2020

Description of the bug

This is a follow-up Issue of #4426

It has been discovered that if a user account got deleted while the comment module was disabled, the comments of these accounts aren't handled properly. As the module was disabled, the hooks didn't run (hook_user_predelete, hook_user_cancel).

The problem arises when re-enabling the comment module - either in broken comments (comment entities without uid of an existing user can't get loaded), or in comments still showing up although they should have been unpublished.

Steps To Reproduce

To reproduce the behavior:

  1. disable comment module
  2. delete a user (or cancel with unpublishing content) who has commented
  3. enable comment module

Additional information

Several suggestions have been made.

  • delete orphaned comments in hook_enable when uid doesn't exist
  • reassign orphaned comments in hook_enable when uid doesn't exist
  • run module hooks regardless of the fact the module is disabled (might be impossible)
  • provide some sort of UI for admins to handle leftover data

We should now figure out what we consider proper handling of orphaned data.

@alanmels
Copy link

@indigoxela, thanks for creating the issue. I do believe when user is getting deleted there is a db query that deletes relevant comments only if the Comment module is enabled. So if that condition was changed so it deletes the user's comments regardless if the module is enabled or disabled, then we will save the DB from lot's of orphaned content.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants