Fixed vB->XF Import: When migrating from vB 3.8 to XF, buddies aren't not properly processing vB buddylist


Well-known member
Version: XF 1.1.4

When migrating from vB 3.8 to XF, buddies aren't properly imported. In library/XenForo/Importer/vBulletin.php, around lines 1243:

if ($user['buddylist'])
    $buddyIds = array_slice(explode(' ', $user['buddylist']), 0, 1000);
    $buddyIds = $this->_importModel->getImportContentMap('user', $buddyIds);
    $this->_importModel->importFollowing($importedUserId, $buddyIds);
Here the getImportContentMap() method is called to map userids contained in $buddyIds from old to new. The problem: the content map, or xf_import_log respectively, doesn't contain all userids yet; it is being filled as new users are processed.

For example, someone with user ID 1 will always have his $buddyIds array erased, and as a consequence will follow nobody, because his user account is the first to be migrated, and xf_import_log doesn't contain any userid maps yet. In other words, whenever there is someone in the buddylist who has not been migrated yet (usually someone with a higher userid), that userid will be removed from the current $buddyIds array.

Related question: I have the "Retain imported content IDs" option selected. Why is the importer still going through the various ContentMaps, which add additional queries for each migrated content item? In cases where 1 will always => 1 (like with user ids), wouldn't it be beneficial if the importer skipped ContentMaps here?