Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Migrating questions from one Q2A instance to another?

+1 vote
asked Oct 1, 2011 in Q2A Core by Scott
edited Oct 2, 2011 by Scott
I'm using Q2A's userbase-sharing function to run a couple of different Q2A sites, with the same users. I've written a plugin that can migrate a question from one instance of Q2A to another.

However, I am just using raw SQL so it's not indexing the new posts when they're added to the database. Is this actually possible to do? Under site "qa_" I don't think you'd be able to reindex a post on say "qameta_".

Any better solution for this?

1 Answer

0 votes
answered Oct 2, 2011 by gidgreen

Use the functions in qa-app-posts.php (Q2A 1.4 or later) which provide an easy interface for retrieving and creating posts, and take care of indexing for you.

commented Oct 2, 2011 by Scott
The problem is, I'm running migration on my base Q2A instance, so calling those functions will only create posts there and not on the second site, right? Maybe I could switch it to the second site to pull in questions from the first.
commented Oct 2, 2011 by gidgreen
Yes, you could do that, but then you have the problem of deleting the posts from the first instance, which is also done most safely via qa-app-posts.php. Your best bet is probably to use a custom MySQL table to manage the process, and have each installation refer to that table as appropriate.
commented Oct 3, 2011 by Scott
I think I see what you mean I'll see if I can find a decent solution. At the moment I am just doing a manual reindex after migrating a bunch of posts which seems to work fine for now.