XF 2.2 Cloning a Xenforo install without threads/posts

arn

Well-known member
I find the size of our database to be cumbersome in making a development/staging site. It's a bit of a pain, and takes up a lot of room on our development server. To the point where we can't easily have multiple installs to do testing on different things.

We already don't copy attachments/avatars, which helps, but I'd like to be able to import a copy of our forums but with no threads/posts, or an abbreviated set of threads/posts.

Is this possible using some procedure? I figure if I start dropping posts/threads indiscriminately, it's going to break things.

Edit: I suppose I could batch delete threads on the dev install and clone that one. I'm not sure how long that will take, but I suppose that's an option.
 
Deleting the content before or after importing is really the only way to do it.

I would probably import the backed up DB and then just prune, using the batch tools as you suggest.
 
you can limit within the dump command.

perhaps, take the first 10 rows of posts/users/etc. you may have some 'dead' things (ie, if user 11+ posted in the first 10 threads) but assuming you had more threads than users in the first few days, it may work.

Code:
mysqldump --opt --where="1 limit 10" database table > dump.sql
 
you can limit within the dump command.

perhaps, take the first 10 rows of posts/users/etc. you may have some 'dead' things (ie, if user 11+ posted in the first 10 threads) but assuming you had more threads than users in the first few days, it may work.

Code:
mysqldump --opt --where="1 limit 10" database table > dump.sql

Thanks! This led me down this path which seemed to work. I got a functional site. I'm sure some things might break if you dig deep, but for theme adjustments and certain add-on testing, I think this will work fine.

My MySQL dump went from 35GB to 4GB using this sequence:

Code:
mysqldump --no-data DATABASENAME > dump.xf.sql
mysqldump --no-create-info DATABASENAME --ignore-table=DATABASENAME.xf_post --ignore-table=DATABASENAME.xf_thread --ignore-table=DATABASENAME.xf_andy_history --ignore-table=DATABASENAME.xf_andy_search_log --ignore-table=DATABASENAME.xf_attachment_data --ignore-table=DATABASENAME.xf_attachment --ignore-table=DATABASENAME.xf_change_log --ignore-table=DATABASENAME.xf_conversation_message --ignore-table=DATABASENAME.xf_conversation_master --ignore-table=DATABASENAME.xf_conversation_recipient --ignore-table=DATABASENAME.xf_conversation_user --ignore-table=DATABASENAME.xf_edit_history --ignore-table=DATABASENAME.xf_ip --ignore-table=DATABASENAME.xf_moderator_log --ignore-table=DATABASENAME.xf_ozzmodz_spaminator_log --ignore-table=DATABASENAME.xf_search  --ignore-table=DATABASENAME.xf_import_log --ignore-table=DATABASENAME.xf_es_thread_similar --ignore-table=DATABASENAME.xf_user_alert --ignore-table=DATABASENAME.xf_thread_watch --ignore-table=DATABASENAME.xf_image_proxy --ignore-table=DATABASENAME.xf_change_log --ignore-table=DATABASENAME.xf_mail_queue >> dump.xf.sql
mysqldump --no-create-info --opt --where="post_date>1602610176" DATABASENAME xf_thread >> dump.xf.sql
mysqldump --no-create-info --opt --where="post_date>1602610176" DATABASENAME xf_post >> dump.xf.sql

1st command dumps schema
2nd dumps data except for these tables. Some are add-on specific, but I looked at the largest tables that I didn't think were needed
3rd dumps threads newer than 1 year ago
4th dumps posts newer than 1 year ago
 
Top Bottom