Incorrect assignment of attachments after vbulletin import

denns

Member
I have problems with the assignment of attachments in posts after the import from vbulletin 2.2.3

attachments from the vbulletin album are now connected with XF posts. see example below...
The attachment 49356 (from vbulletinn album, contenttypeid=8) is now connected with xf post 1384.

did I do something wrong?


vbulletin DB:
attachment.JPG
 

Mike

XenForo developer
Staff member
How are you determining how that attachment is connected to a specific post in XF?

The importer only pulls attachments with the post content type, so based on your screenshot, only the attachments with content type 1 or 8 would've been imported as post attachments. (The correct content type is looked up as part of the import.)

You mention an album attachment, but I'm assuming that you actually ran the forum/core vBulletin import, so we're actually talking about importing post attachments. If you ran a vBulletin album import, then I'd probably go back to my original question, as there would be an attachment record in XF, but it wouldn't be connected to a post.
 

Mike

XenForo developer
Staff member
Ahh right, I think I see how this is happening. We go back after fetching the attachments and fetch based on the filedataid, but we don't appear to respect the contenttypeid limit in the second query. I'm going to have to move this to bugs, though I'm not clear on what the best resolution will be yet.

However, in terms of a one off fix, I think I see a relatively simple workaround. Note that if you're importing blogs, this would probably interfere with importing attachments from them, so let me know if that's a problem.

Otherwise, in src/addons/XFI/Import/Importer/vBulletin4.php, I think you can change:
Code:
WHERE filedata.filedataid IN({$fileDataIds})
to:
Code:
WHERE filedata.filedataid IN({$fileDataIds}) AND attachment.contenttypeid = 1
 
Top