Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Users, Groups and Permissions #10

Open
madmas opened this issue Aug 15, 2015 · 2 comments
Open

Migrate Users, Groups and Permissions #10

madmas opened this issue Aug 15, 2015 · 2 comments

Comments

@madmas
Copy link

madmas commented Aug 15, 2015

Hi,
currently,the migration does not include the security related options like Users, Groups and Permissions.
Is there a special (technical) reason to this (besides the all-known time issue) .
What steps do you think would be necessary to include that to the script?
I'd be happy to help where I can ;-)

@madmas
Copy link
Author

madmas commented Aug 15, 2015

Hi, I created a SQL script to transfer the users

--Transfer users
INSERT INTO piwigo.piwigo_users(username, password, mail_address)
SELECT g_userName, g_hashedPassword, g_email
FROM gallery.g2_User g2u
WHERE g2u.g_userName NOT IN ('admin', 'guest', 'test')

--create default settings
INSERT INTO piwigo_user_infos (user_id, nb_image_page, status, language, expand, show_nb_comments,  show_nb_hits,   recent_period,  theme,registration_date ,   enabled_high,   level,  activation_key ,    activation_key_expire , lastmodified)
SELECT u.id, 30,  'normal', 'de_DE',false,false,false,  7, 'simpleng', now(),   true, 0, NULL, NULL,now()
FROM piwigo_users u
WHERE id NOT IN (1,2)

and one to transfer the ratings:

INSERT INTO piwigo.piwigo_rate (user_id, element_id, anonymous_id, rate, date)
SELECT pusers.id, pimages.id, CONCAT(LEFT(rm.g_remoteIdentifier, INSTR(rm.g_remoteIdentifier,':')),RAND()) ,rm.g_rating, now()
FROM gallery.g2_RatingMap rm 
, gallery.g2_User u
, gallery.g2_Item i
, gallery.g2_FileSystemEntity fse
, piwigo.piwigo_users pusers
, piwigo.piwigo_images pimages
WHERE rm.g_itemId = i.g_id
AND fse.g_id = i.g_id
AND rm.g_userId = u.g_id
AND pusers.username = u.g_UserName
AND fse.g_pathComponent = pimages.file

@42degrees
Copy link

Thank you madmas, these queries were exactly what I needed to finish off my migration from Gallery2 to Piwigo. Seems like the guy who wrote the menalto2piwigo could integrate these into his plug-in... (though I completely appreciate him/her writing this plugin as well).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants