PDA

View Full Version : Migrate Photoplog to vB5


pyro2927
03-26-2014, 05:04 PM
I'm working on a script to migrate existing Photoplog pictures to vBulletin 5 photos/albums. It looks like each element in vB5 is a node, and the photo table links an entry on filedata and a node.

I have userids, descriptions, and files currently in place. I've been able to import the files into the filedata table by using LOAD_FILE() in MySQL, but I haven't been able to get the photos to show up on the user's profile page. I am attempting to create an Album node, and it appears in the database and is assigned to the correct userid, but it doesn't show up on their page.

Here is the script I've been working on:
http://hastebin.com/vulefepega.rb

Lynne
03-26-2014, 11:04 PM
I don't see you inserting the data into the photo or gallery tables. filedata basically has the image data for every file, but photo has the nodeid for each along with any caption. And then gallery keeps track of everybodies 'galleries' (a person may have several galleries each for a different subject).

So, say I have three 'galleries' in my media tab, like this:

Cats
- image 1
- image 2
Dogs
- image 3
- image 4
Favorite Images
- image 1 (again)
- image 4 (again)

That is four different entries into the filedata table (for four different images)
That is six different entries into the photo table (for each time the image is used)
That is three different entries into the gallery table (for the three galleries for this user)
That is nine different entries into the node table (for the three galleries and the six photos)

I hope that helps out.

pyro2927
03-29-2014, 11:55 PM
I think that helps get me on the right track, thanks!

I've added a gallery in as a node and as by adding an entry under the "gallery" table, linking the newly created nodeid. The node is assigned to my userid and has a routeid of 50 and a contenttypeid of 22. The gallery I created through the UI seems to have similar values, yet this hand-inserted one is not showing up on my user page. Any idea on why that might be? Pasted below is the entry:

nodeid routeid contenttypeid publishdate unpublishdate userid groupid authorname description title htmltitle parentid urlident displayorder starter created lastcontent lastcontentid lastcontentauthor lastauthorid lastprefixid textcount textunpubcount totalcount totalunpubcount ipaddress showpublished oldid oldcontenttypeid nextupdate lastupdate featured CRC32 taglist inlist protected setfor votes hasphoto hasvideo deleteuserid deletereason open showopen sticky approved showapproved viewperms commentperms nodeoptions prefixid iconid
650540 50 22 1396136765 NULL 1750 NULL BlueGT88 NULL Photoplog Migration Photoplog Migration 9 photoplog_migration NULL 649830 1396136765 1396136765 649830 BlueGT88 1750 0 0 0 0 1 NULL NULL NULL NULL 0 NULL 1 0 0 0 0 0 NULL NULL 1 1 0 1 1 2 1 138 0

Update: Looks like the previous script isn't loading anymore, here is the updated one:
http://pastie.org/private/pcvethjqfi60yivnzegwa

Lynne
03-30-2014, 05:34 PM
Did you make sure to go to Maintenance > Clear System Cache after you added your stuff to the database?

And, I forgot to mention... the closure table. (Honestly, I try to forget about that table!).

Every one of your nodes will have at least one row in there. For Galleries, they will have one for themselves and each photo in it.
parent: 650540
child: 650540
depth: 0
display order: 0
publishdate: 1396136765

Then say you have a photo with nodeid x in that gallery (same publish date):
parent: 650540
child: x
depth: 1
display order: 0
publishdate: 1396136765

AND, a row for itself:
parent: x
child: x
depth: 0
display order: 0
publishdate: 1396136765

pyro2927
03-31-2014, 02:10 PM
Ah, totally didn't know about the closure table! Maybe that's the piece I've been missing! I'll work on that and see if it works, thank you so much!