Page 1 of 1

Restor posts

Posted: Fri Jan 17, 2020 9:32 am
by Cliff Evans
Is it possible to restore user posts that have been deleted? I have a backup of the Db from before the deletion but only want to restor posts from one user.

Re: Restor posts

Posted: Fri Jan 17, 2020 9:43 am
by warmweer
Cliff Evans wrote:
Fri Jan 17, 2020 9:32 am
Is it possible to restore user posts that have been deleted? I have a backup of the Db from before the deletion but only want to restor posts from one user.
Yes, it's possible, but the question is how many posts you want to restore.
If there are few, the easiest way would be to enter them manually using the normal board features (writing the post, saving, then assigning the post to a different user, possibly also changing the post_time.).
If there are many it could be done with SQL but that is (a lot) more complicated.

Re: Restor posts

Posted: Fri Jan 17, 2020 9:45 am
by Mick

Re: Restor posts

Posted: Fri Jan 17, 2020 9:46 am
by Cliff Evans
Thanks for the quick reply. 1787 posts including photos, quite a lot!!

Re: Restor posts

Posted: Fri Jan 17, 2020 9:46 am
by Cliff Evans
Mick wrote:
Fri Jan 17, 2020 9:45 am
Have you got soft delete active? https://www.phpbb.com/support/docs/en/3 ... ls_delete/
Unfortunately no!

Re: Restor posts

Posted: Fri Jan 17, 2020 9:47 am
by Cliff Evans
It is my own fault, rushing through things!!

Re: Restor posts

Posted: Fri Jan 17, 2020 10:47 am
by david63
Cliff Evans wrote:
Fri Jan 17, 2020 9:46 am
Thanks for the quick reply. 1787 posts including photos, quite a lot!!
And how many posts since?

Re: Restor posts

Posted: Fri Jan 17, 2020 11:46 am
by Cliff Evans
From other users, quite a few!

Re: Restor posts

Posted: Fri Jan 17, 2020 1:25 pm
by warmweer
The first thing you should do is to extract all the posts from that user to a dedicated table and then take your time to perform some thorough checks.
Check whether the post_id's are still available (join with the current posts_table: if there are no records so much the better, if there are you'll have to edit)
Check whether the topic still exists (you may have deleted a topic if no other user posted in that topic, in which case the topic has to be inserted also).
Just check everything you can think of (e.g. does the forum in which each post was made still exist).

At the end you'll probably want to set the user's postcount correct also, (and the postcounts per forum, per topic).

It's feasible but not something you should try on a live forum before having tested the procedure.

IIRC there was a similar request about 2 months ago (for a lot more posts even).

Re: Restor posts

Posted: Fri Jan 17, 2020 1:38 pm
by Cliff Evans
Thank you.