Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-10605

Orpahned privmsgs are left in the prvmsgs table, with no ties in privmsgs_to table

    Details

      Description

      Some private messages remain in privmsgs table, even though they have no ties in privmsgs_to anymore. For example my board reports 2,033 results with
      SELECT `msg_id` FROM `phpbb_privmsgs` WHERE `msg_id` NOT IN (SELECT `msg_id` FROM `phpbb_privmsgs_to`)

      All those messages are not accessible through any users UCP. I is not clear how it happened. As posted in the Support Forum under
      http://www.phpbb.com/community/viewtopic.php?f=46&t=2108416#p12886345
      such can happen, if a message from a deleted user is deleted. But this isn't necessarily the only way this can happen.

      It isn't clear how this messages slipped through the deletion process. It seems however, that user_delete() from /includes/function_user.php might be responsible. It seems to delete messages from privmsgs that the deleted user send but that haven't been read by the recipient. However it is unclear if this includes unread messages that the recipient moved to other folders automatically via rules.

      Also all privmsgs_to links to the user as recipient are deleted, but it seems it isn't checked whether or not this was the last link for that message (if the recipient(s) already deleted the messages).

        Issue Links

          Activity

          Hide
          heinrich_k heinrich_k added a comment -

          Additionally, for all databases already affected, it might be nice, if the update process to the next version would check for orphaned privmessages and delete them, or if a button to do so was added to the ACP.

          Show
          heinrich_k heinrich_k added a comment - Additionally, for all databases already affected, it might be nice, if the update process to the next version would check for orphaned privmessages and delete them, or if a button to do so was added to the ACP.
          Hide
          nickvergessen Joas Schilling added a comment -

          We could also add a cron task to delete them once in a while.

          Show
          nickvergessen Joas Schilling added a comment - We could also add a cron task to delete them once in a while.
          Hide
          heinrich_k heinrich_k added a comment -

          Sure, we could, but actually using a function to delete privmsg_to-links instead of just dropping them, when a user is deleted, would possibly be a nicer way to go. For such a function could check whether or not it was the last link to a message and if so, delete the message right away.

          Show
          heinrich_k heinrich_k added a comment - Sure, we could, but actually using a function to delete privmsg_to-links instead of just dropping them, when a user is deleted, would possibly be a nicer way to go. For such a function could check whether or not it was the last link to a message and if so, delete the message right away.
          Hide
          bantu Andreas Fischer added a comment -

          A cronjob is pretty useless/pointless. Just make sure it is properly deleted and delete all affected messages in the updater.

          Show
          bantu Andreas Fischer added a comment - A cronjob is pretty useless/pointless. Just make sure it is properly deleted and delete all affected messages in the updater.
          Hide
          nickvergessen Joas Schilling added a comment -

          Which is just what I did

          Show
          nickvergessen Joas Schilling added a comment - Which is just what I did
          Hide
          heinrich_k heinrich_k added a comment -

          The problem should have been fixed a while back, but I just rechecked and I again have serveral thousand privmsgs not tied to phpbb_privmsgs_to...

          Show
          heinrich_k heinrich_k added a comment - The problem should have been fixed a while back, but I just rechecked and I again have serveral thousand privmsgs not tied to phpbb_privmsgs_to...

            People

            • Assignee:
              nickvergessen Joas Schilling
              Reporter:
              heinrich_k heinrich_k
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development