I recently set about migrating an aging phpBB forum to NodeBB and ran into enough problems that I considered cancelling the whole project.
The phpBB exporter script has been updated various times, and I managed to find a fork which appears to work with phpBB 3.2. Unfortunately, it refused to install itself correctly and appeared to land in the wrong directory, so I had to manually clone the Github project into the expected subdirectory.
And bingo! The import worked, and after disabling/deleting unnecessary plugins and updating NodeBB to the latest branch, the majority of things were working as expected. A few things remain to be fixed, in particular navigating mongodb’s structure to perform a few custom replacements where the import script had trouble deciphering bbcode.
Fortunately StackOverflow provided a good start:
var bulk = db.getCollection('objects').initializeUnorderedBulkOp();
var count = 0;
db.getCollection('objects').find({$and: [{_key:{$regex: /^post:\d+$/}}, {content: {$regex: /<size size="150">(.*?)<\/size>/}}]}).forEach(function(entry){
var newContent = entry.content.replace(/^<size size="150">(.*?)<\/size>/gm, "## $1");
print(newContent);
bulk.find( { _key: entry._key } ).updateOne( {
$set: { 'content': newContent }
});
count++;
if (count % 100 === 0) {
// Execute per 100 operations and re-init
bulk.execute();
bulk = db.getCollection('objects').initializeUnorderedBulkOp();
count = 0;
}
})
// Clean up queue
if (count > 0) bulk.execute();
Using this I was able to find and replace those tags which had been missed and replace them with valid markdown.