Hi Q2A community,
I have a backup of an OSQA site that I used to run back in 2011. The backup is in XML format with a structure of files, e.g:
-
[xsd/]
-
badges.xml
-
CloseReasons.xml
-
Comments2Votes.xml
-
FlatPages.xml
-
Messages.xml
-
MessageTypes.xml
-
ModeratorMessages.xml
-
...
-
VoteTypes.xml
I'm planning to write some code that will loop through the Posts.xml file and restore all the data there, inserting each post as a single-line entry into qa_posts, with structure something along the line of:
(X, Q, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, 1, NULL, 2090122648, NULL, NULL, 0, 0, NULL, NULL, 1, NULL, [IPADDRESS], NULL, NULL, 0, 0, 0, [IPADDRESS], 1, 21553800000, 0, NULL, [TODAYSDATE], NULL, NULL, [TITLE], [CONTENT], [Tags seperated by commas])
The userID will be a generic administrator user with a name such as 'Community' or 'Robot' or something like that.
I could probably extend the script to also allow for users, but since it's been about a year since the site was live, I doubt many (any?) of the users will magically jump on the site and try to login again.
Before I delve into this and start writing code, has anyone already achieved what I'm about to attempt? Any pointers? Am I taking the right approach? I'd rather re-use some other code if someone has already done this succesfully.
Cheers.