Steffen
Well-known member
- Affected version
- 2.0.0
The importer tries to import posts in batches of 200 but only the first 200 posts per thread ever make it into XenForo. In the method "stepPosts", when the inner loop
My test import has resulted in lots of threads with exactly 200 posts each.
Maybe it would be better to use a single loop over all posts instead of two nested loops over threads and their posts? That would simplify things and solve an edge case that would still exist even if the mentioned bug was fixed: I suspect posts could still get lost if there are two posts in the same thread with exactly the same dateline and if these posts fall onto a batch border (if the last post of batch n has dateline x then in batch n+1 the importer only considers posts with dateline > x). Ok, I admit it's an edge case (although not impossible). But it could be solved by using a single loop.
You seem to have chosen the nested loop to more easily compute the "position" of each post. But isn't the "position" recomputed during the "finalize" step anyway?If it isn't then a single loop over all posts sorted by "threadid ASC, dateline ASC" could be the solution (you'd only have to remember a single "position" value).
(For performance reasons: Can we maybe skip updating "xf_thread_user_post" during the import because that table will be rebuilt during the finalize step, too?)
foreach ($posts AS $oldId => $post) { ... }
finishes then the importer will move on with the next thread and never consider the remaining posts of the last thread again.My test import has resulted in lots of threads with exactly 200 posts each.
Maybe it would be better to use a single loop over all posts instead of two nested loops over threads and their posts? That would simplify things and solve an edge case that would still exist even if the mentioned bug was fixed: I suspect posts could still get lost if there are two posts in the same thread with exactly the same dateline and if these posts fall onto a batch border (if the last post of batch n has dateline x then in batch n+1 the importer only considers posts with dateline > x). Ok, I admit it's an edge case (although not impossible). But it could be solved by using a single loop.
You seem to have chosen the nested loop to more easily compute the "position" of each post. But isn't the "position" recomputed during the "finalize" step anyway?
(For performance reasons: Can we maybe skip updating "xf_thread_user_post" during the import because that table will be rebuilt during the finalize step, too?)
Last edited: