After migrating

quake101

Joined: 2007-02-27
Posts: 13
Posted: Thu, 2007-03-08 14:26

How do I update user albums to point to the user albums that where imported?

Gallery version = 2.2-rc-1 core 1.1.26
PHP version = 4.3.2 apache2filter
Webserver = Apache/2.0.46 (CentOS)
Database = mysql 4.1.18-standard, lock.system=flock
Toolkits = ArchiveUpload, Exif, Ffmpeg, ImageMagick, Gd
Acceleration = none, none
Operating system = Linux badassmustangs.com 2.4.21-40.EL #1 Wed Mar 15 14:30:04 EST 2006 i686
Default theme = matrix
gettext = enabled
Locale = en_US
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2) Gecko/20070219 Firefox/2.0.0.2
Rows in GalleryAccessMap table = 100
Rows in GalleryAccessSubscriberMap table = 2434
Rows in GalleryUser table = 18
Rows in GalleryItem table = 2432
Rows in GalleryAlbumItem table = 239
Rows in GalleryCacheMap table = 0

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2007-03-08 20:28

imported from where/what?

--------------
Doumentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
quake101

Joined: 2007-02-27
Posts: 13
Posted: Thu, 2007-03-08 20:35

I imported all my user albums from coppermine.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2007-03-08 23:28

there's no feature to do that with a few clicks.

see:
modules/useralbum/UserAlbumHelper.class function createUserAlbum().

- i'd go to site admin -> useralbum. change the "when to create" setting to "when first accessed."
- if you look at createUserAlbum(), you see that it mainly does 3 things:
1. create an album
2. set permissions for that album such that the user has all permissions for that album
3. map the id of the album to the user id

i guess you don't need step 1, you have those albums already.
i see that you have 18 users. so there's no point in automating things too much.

you'll have to look up the album ids and user ids and you can then map them by inserting a row in the g2_PluginParameterMap table.

GalleryCoreApi::setPluginParameter('module', 'useralbum', 'albumId', $albumId, $user->getId());

which translates into this SQL:
INSERT INTO g2_PluginParameterMap (g_pluginId, g_pluginType, g_parameterName, g_parameterValue, g_itemId)
VALUES ('useralbum', 'module', 'albumId', $albumId, $user->getId());

--------------
Doumentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
quake101

Joined: 2007-02-27
Posts: 13
Posted: Fri, 2007-03-09 01:23

Thank you, I manually updated the database. Now my user's albums are correct! :)