- Affected version
SELECT att.*, f.*, u.username, a.*, att.attachmentid AS pictureid FROM attachment AS att
SELECT c.*, u.*, IF(u.username IS NULL, c.postusername, u.username) AS username, c.filedataid AS pictureid FROM picturecomment AS c
So the media items do get imported using the old field
attachmentid, but the comments do use
filedataidfor lookups - this does not work as those are different IDs (in vBulletin 4 the same filedataid can be used for multiple attachments so they are not necessarily always the same).
The correct ID is in field
sourceattachmentid, but to make things a little bit more fun, this field seems to be set to zero for comments that were created with vBulletin 3.
Furthermore, the comment query lacks a check on contenttypeid as only comments for album pictures (buit not social group pictures) can be imported at all.