1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MG 1.1 Import from vb 4.2 comments unusual situation

Discussion in 'Media Gallery Support' started by janslu, Nov 5, 2015.

  1. janslu

    janslu Member

    I'm working on a big board migration to Xenforo. Currently I stumbled on an unusual problem. I want to import 60.000 photos comments from vbulletin albums to xmg. Albums and photos are imported properly, but comments got stuck on an error of duplicated unique id in commentid = 12.

    I've dug deeper and realized that there is a problem in the importer, that will show up only in special circumstances. Vbulletin allows to use the same fileid (one physically uploaded photo) in more than one album photos and comments are assigned to fileid and not to the album representation of a file. For example I have a single album with two separate instances of the same mediafile (filedataid = 210390, attachmentid = 210,416, 210420). One comment (commentid = 12) is "shared" between them and displayed twice, under both photos. During the import the process tries to insert two comments with the same commentid which is not possible.

    I want to retain original ids as much as possible for the content where it is important (albums and photos - because of urls for example), but I don't really care for comment ids, because they don't really matter for me.

    Has anyone encountered the same problem? What is the best solution?
  2. Chris D

    Chris D XenForo Developer Staff Member

    To the best of my recollection this hasn't come up in the last few years and there have been a reasonable number of imports.

    This will likely need to be looked at in more detail, which will take some time, but I think there's potentially a quick solution for you.

    When you get to the Comments step, you will need to edit the file library/XenGallery/Importer/vBulletin42x.php and find:
    And change that to:
    Make sure you change it back once the comments have been imported, though. While the code is edited as above, it will no longer retain the original IDs and it should mean that any duplicate comments should get imported with separate IDs.

    Longer term, we'll look at this as a bug, and look to fix it in a future version.
  3. janslu

    janslu Member

    Thanks. I've tried this but it seems than only some comments were migrated - vbulletin table shows almost 60.000 comments, import scripts reports 3.500 migrated. I will look further into this tomorrow.

    One more thing - the comments query should also take contenttypeid into consideration - I've had at least one case of a single image inserted into user album and into social group photos - those were also sharing comments. So in this particular situation your comment import query reported three separate records - two for a copied photo albums and one for a social group photo - of course those were all derivatives of a single image file. Comments in Vbulletin 4.2 were shared between those assets.

Share This Page