Announcement

Collapse
No announcement yet.

Restoring a single member, posts and threads from a backup

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Restoring a single member, posts and threads from a backup

    When using the Move/Prune, I decided to get rid of the 300-something "Waiting for email confirmation" users that are over 30 days old. When it ran, I noticed a really old member's name in the scroll... and I thought, what's he doing there? Then it dawned on me, maybe that "Waiting for email confimation" group also includes people who have been long time members and have tried to reset their pw.... oy.


    So, I have a working copy of the db I can access in phpMyAdmin (I make daily backups with sqldump). Here's the plan:

    I will look for his userid number in the copy db.
    Make a new user with that userid in the real db.
    Query all threads and posts (anything else?) in the copy db that have that userid.
    Export these threads and posts.
    Import these threads and posts into the real db.

    That should restore him and his threads and posts, right?

    What's missing here, this sounds too easy!

    Maybe he'll lose subscriptions and PMs, but I don't think he's that active anyway. Mainly I want to preserve his posts, because they are referenced by other users' posts.

  • #2
    At this point you might be better off restoring from your backup and lose the few hours of posts that were made today.

    Comment


    • #3
      Because..... ?

      Comment


      • #4
        Making a "new" user with the same userid is not as simple as just adding them to the user table.

        A better plan would be create the new user, then import the old users threads and posts, then update the old userid to the new userid in the thread and post tables.
        Baby, I was born this way

        Comment


        • #5
          Originally posted by Paul M View Post
          Making a "new" user with the same userid is not as simple as just adding them to the user table.

          A better plan would be create the new user, then import the old users threads and posts, then update the old userid to the new userid in the thread and post tables.
          Yeah! That sounds logical. Thanks, guys.

          Comment


          • #6
            Hmmm. After checking the db, the prune function removed the user from the user table, but his threads and posts are still in their tables. All I had to do was create a new user, then

            UPDATE thread SET postuserid = 452972
            WHERE postusername = 'Guy'

            UPDATE post SET userid = 452972
            WHERE username = 'Guy'

            Then I went to his profile, updated his Join date total posts count to match previous, and voila!

            I guess it pays not to reset counters frequently

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...
            X