User migration

jhmac

Joined: 2009-04-18
Posts: 44
Posted: Thu, 2010-02-18 22:45
Quote:
Gallery URL = http://www.rockstarrated.com/rrgallery/main.php
Gallery version = 2.3.1 core 1.3.0.1
API = Core 7.54, Module 3.9, Theme 2.6, Embed 1.5
PHP version = 5.2.10 cgi-fcgi
Webserver = Apache
Database = mysqli 5.0.81-community, lock.system=database
Toolkits = ImageMagick, SquareThumb
Acceleration = partial/3600, partial/3600
Operating system = Linux server.richmondrockstarrated.com 2.6.18-028stab059.6-ent #1 SMP Fri Nov 14 15:51:43 MSK 2008 i686
Default theme = rockstar
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7
Rows in GalleryAccessMap table = 55
Rows in GalleryAccessSubscriberMap table = 16407
Rows in GalleryUser table = 4
Rows in GalleryItem table = 16404
Rows in GalleryAlbumItem table = 141
Rows in GalleryCacheMap table = 94

Sorry to post this yet again. I have found several posts on the topic but nothing about really implementing them in a beginners kind of way. I recently changed hosts (went from shared to vps) and did a fresh install of gallery 2. After uploading all the pics from the old gallery and making some graphical tweaks all I am left with is to somehow get the users from the old gallery migrated to the new one so they dont have to re-register. From the reading a simple copy of the user table wont do since the id's are used in several tables. I only have about 40 users at the moment so I dont have a problem hand coding them in except i dont think I can just copy the scrambled password info from the old database into the new one and expect it to work.
So coding aside ( that i have found in other threads) what would be the easiest way to do this?

Again, sorry for the reasking of the same question, just want it broken down in a more understandable format.

thank you,
justin

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2010-02-18 22:55

are the users from another cms or from gallery?
what format is the data?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Thu, 2010-02-18 23:10

From gallery.
format I'm not sure. It's whatever the default was when gallery2 was installed.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2010-02-18 23:13

So you have a DB backup in sql or xml format? You know with your user information in it?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Thu, 2010-02-18 23:19

well technically this site isn't live yet. Still using the other gallery install currently so the db's there are still active and I still have access to them if needed.

btw your media feed is great. I donated to gallery a couple weeks ago. You're next on my list when I build my funds back up :)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Fri, 2010-02-19 00:43
Quote:
I donated to gallery a couple weeks ago

We really appreciate all the support :)

Well, we could write a script to export all necessary user info and another to create users on the other end.
But it would be nearly impossible to keep things like user comments, ratings, keywords, and even ownership of images as all the images now have new ids as well.

If your old gallery is still working, why not migrate the whole thing?
http://codex.gallery2.org/Gallery2:FAQ#How_can_I_move_my_gallery_installation_from_one_server_to_another.3F

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Fri, 2010-02-19 07:59
Quote:
Well, we could write a script to export all necessary user info and another to create users on the other end.
But it would be nearly impossible to keep things like user comments, ratings, keywords, and even ownership of images as all the images now have new ids as well.

I only have maybe 7 comments anyways. Ratings haven't really been used either and the only owners of the photos are pretty much myself and the photographer so I don't have any issues losing that information. I just dont want to make the 40 people registered already have to reregister.

Quote:
If your old gallery is still working, why not migrate the whole thing?

When I first came across gallery I was pretty much only in the know how with html coding. I didn't really get into php and related code until the gallery stuff where I began kind of teaching myself the basics. The changes I made to the files and themes were made directly, not in a separate folder like gallery had suggested. It's been a year since then and my understanding of the code has increased dramatically (still learning though) so I wanted to do a fresh install and actually make the changes properly as to not affect anything else in the other folders. I've also taken better notes on the changes I made this time as opposed to last time.

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 17:23

Played around with phpmyadmin stuff. downloaded the user table in sql format. I did attempt an insert using that data but when I went to look at the users on the site I got an error so I assume there was another table I might have missed. Went back and deleted all the rows I added and the user section came up without an error. I would be interested in the script to add, just not sure which tables are interconnected with the users. Next step/idea?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 17:50

I can write something for ya... prolly take a few hours.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 19:13

That would be cool. I do know some basic sql (inserting, updating, altering, etc). Is that what you were thinking as far as the writing. I don't want to waste your time as I'm pretty sure you have your hands full with others. It's mainly the db tables that I'm not sure need updating. Your call, I'll definately accept the scripting and will owe you guys for it :)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 23:59

Ooops! almost forgot about ya.

upload a copy to both sites yoursite.com/gallery2/g2_user_import.php
so the script should be next to your gallery's embed.php and main.php

on the site to export visit the page and copy the whole output - should be something like:
$importUsers = Array(......

on the site you're importing to:
replace the second line: $importUsers = Array(); with the output from the other.

visit that page with your browser once.

done.

Let me know if it works ok.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 21:04

Oh and make sure you backup the receiving DB first.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 21:34

Just want to make sure. This won't delete the users from the old gallery right? It will just import their information correct.

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 21:44

Parse error: syntax error, unexpected '[', expecting ')' in /home/rocks26/public_html/rrgallery/g2_user_import.php on line 2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 22:11

did you replace the whole 2nd line with the whole output from the first script?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 22:47

yessir. I will copy and paste and try again to make sure. Just wasn't sure if I should attempt again since you had said to refresh only once.

EDIT: Just copied and pasted the code again. same message.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 23:00
 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 23:06

sent

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 23:11

http://yoursite.com/Gallery2/gallery2/g2_user_import.php
Forbidden

You don't have permission to access /Gallery2/gallery2/g2_user_import.php on this server.

Yeah, that does not help me at all - wasting my time.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 23:29

Sorry. I had commented on that in the PM. didn't want to expose peoples emails to the world so I temporarily cut off permissions. I changed the permissions back to what they were if you want to take another peek.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 23:37

Ok, I updated the above script, you'll have to re-copy and follow the steps.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Sun, 2010-02-21 23:54

Parse error: syntax error, unexpected T_FUNCTION in /home/rocks26/public_html/rrgallery/g2_user_import.php on line 4

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2010-02-21 23:57

oops, remove the "Done" at the end of the copied output.
Was restarting my server and did not have somewhere to test.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jhmac

Joined: 2009-04-18
Posts: 44
Posted: Mon, 2010-02-22 00:13

Success!! It did import all of the users along with the info. It didn't seem to take to the passwords though as my password I used on the other site didn't work. As long as the users have been imported I am ok with that. Since I'm not sure if it was just my password that didn't stick, I'll assume the other users can try and if not just use the recovery feature to reset it (which I tested and worked).
Thank you for your patience and help there super. Much appreciated and your mediablock package is the next donation on my list :)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2010-02-22 00:24

I updated the script attached above to remove the "Done" at the end.

I'm glad it worked for you.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2