Hello phpBB community.
Returning to this recurring issue with a new solution.
Before applying it to the production database, all kind advises welcome.
Reference:
3.2 Support Forum "restore a single topic from backup"
In this old topic, @stevemaury suggested to get the data for the deleted topic from a full backup like this:
SELECT * from phpbb_posts WHERE topic_id = X;
SELECT * FROM phpbb_topics WHERE topic_id = X;
SELECT * FROM phpbb_topics_posted WHERE topic_id = X;
SELECT * FROM phpbb_topics_watch WHERE topic_id = X;
SELECT * FROM phpbb_topics_track WHERE topic_id = X
And then restoring the lines to production, with update clauses.
I found this a bit complicated, but the SELECT statements from above useful.
Came up with this BASH script.
Replace phpBBdatabase and topic number with yours.
As it is, the backup which contains the deleted post is for 3.2.11 and by the time the deletion was noticed, we had done an upgrade to 3.3.11.
In any case, as I tested it, the topic is restored correctly even to 3.3.11.
Question is, am I missing something?
These five tables enough?
Test environment did not break at least, but I am hesitating to run this against production.
The above method of course requires, you have full terminal access to your board system and an test environment.
Returning to this recurring issue with a new solution.
Before applying it to the production database, all kind advises welcome.
Reference:
3.2 Support Forum "restore a single topic from backup"
In this old topic, @stevemaury suggested to get the data for the deleted topic from a full backup like this:
SELECT * from phpbb_posts WHERE topic_id = X;
SELECT * FROM phpbb_topics WHERE topic_id = X;
SELECT * FROM phpbb_topics_posted WHERE topic_id = X;
SELECT * FROM phpbb_topics_watch WHERE topic_id = X;
SELECT * FROM phpbb_topics_track WHERE topic_id = X
And then restoring the lines to production, with update clauses.
I found this a bit complicated, but the SELECT statements from above useful.
Came up with this BASH script.
Code:
#!/bin/bash# Get data for topic 4330mysqldump phpBBdatabase phpbb_posts --no-create-info --where="topic_id=4330" --complete-insert > recordfilemysqldump phpBBdatabase phpbb_topics --no-create-info --where="topic_id=4330" --complete-insert >> recordfilemysqldump phpBBdatabase phpbb_topics_posted --no-create-info --where="topic_id=4330" --complete-insert >> recordfilemysqldump phpBBdatabase phpbb_topics_watch --no-create-info --where="topic_id=4330" --complete-insert >> recordfilemysqldump phpBBdatabase phpbb_topics_track --no-create-info --where="topic_id=4330" --complete-insert >> recordfilemysql -u root -p phpBBdatabase < recordfile### END
As it is, the backup which contains the deleted post is for 3.2.11 and by the time the deletion was noticed, we had done an upgrade to 3.3.11.
In any case, as I tested it, the topic is restored correctly even to 3.3.11.
Question is, am I missing something?
These five tables enough?
Test environment did not break at least, but I am hesitating to run this against production.
The above method of course requires, you have full terminal access to your board system and an test environment.
Statistics: Posted by Foxina — Tue Apr 23, 2024 8:38 am