Code: Select all
#!/bin/bash
# Get data for topic 4330
mysqldump phpBBdatabase phpbb_posts --no-create-info --where="topic_id=4330" --complete-insert > recordfile
mysqldump phpBBdatabase phpbb_topics --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_topics_posted --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_topics_watch --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_topics_track --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_bookmarks --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_poll_options --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_poll_votes --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_attachments --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
#mysqldump phpBBdatabase phpbb_drafts --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_log --no-create-info --where="topic_id=4330" --complete-insert >> recordfile
# need to get all post_ids which are related to the topic 4330
post_ids=$(mysql phpBBdatabase -N -e "SELECT GROUP_CONCAT(post_id SEPARATOR ',') FROM phpbb_posts WHERE topic_id = 4330;")
# to populate phpbb_search_wordmatch and phpbb_reports tables
if [ -n "$post_ids" ]; then
# mysqldump phpBBdatabase phpbb_search_wordmatch --no-create-info --where="post_id IN ($post_ids)" --complete-insert >> recordfile
mysqldump phpBBdatabase phpbb_reports --no-create-info --where="post_id IN ($post_ids)" --complete-insert >> recordfile
else
echo "No post_id values found."
fi
### END
The deleted topic is also available.
Not found by phpBB Native Fulltext search though.
Trying to rebuld the index from ACP gui in test environment crashes.
Probably would need a cli option for that.