Imbed: delete user problem - album still there, next user with same name, has different URL

hjho

Joined: 2005-10-22
Posts: 15
Posted: Sat, 2007-02-17 08:36

1. Using the GalleryEmbed API, I create a user "bbb", add some photos, then delete user "bbb".

- I noticed that the album bbb still exists and so do the photos. Is there a 'switch' to delete the albums automatically?

2. After that, I create user "bbb" again, add some photos.

- I noticed that the short URL is now "/bbb_001" instead of "/bbb". I assume it is because the directory bbb already exists? Note that I use the URL mapping to map user bbb's photos into "http://myhostname/bbb".

- So I delete the user "bbb" for the 2nd time, and I also manuall rm -rf the "bbb" and "bbb_0001" directories.

3. After that, I create "bbb" for the 3rd time, then add some photos.

- The assigned short URL is "bbb_002" and uses the same directory name.

- Obviously gallery keeps track of previous USER -> AlbumDataDirectory information. Is there anyway for me to
(a) clear old directories after the user is deleted?
(b) reset this mapping information from the database so that the next user with the same name will have the same URL as the username?

Quote:
Gallery version = 2.1.1 core 1.1.0.1
PHP version = 5.0.4 apache2handler
Webserver = Apache/2.0.54 (Fedora)
Database = mysql 4.1.19, lock.system=database
Toolkits = ArchiveUpload, Dcraw, Exif, Ffmpeg, Getid3, NetPBM, SquareThumb, Thumbnail, Gd, ImageMagick
Acceleration = none/900, none/900
Operating system = Linux seagull 2.6.15-1.1833_FC4smp #1 SMP Wed Mar 1 23:55:52 EST 2006 x86_64
Default theme = PGtheme
Locale = en_US
Browser = Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2007-02-17 09:33

1.

by default, g2 doesn't delete albums / items of a user when you delete the user. it reassigns the ownership to an admin account.
if you delete a user with site admin -> user -> delete, then you can choose whether you want to delete all the user's items or whether you want to reassign the ownership.

through the API, you have to manually reassign the ownership first, and then delete the user.

2. yes, that happens because the bbb album already exists.
you're using the useralbum module. that's why it automatically creates the bbb album. deactivate the useralbum if you don't want this feature.

and please don't do anything yourself (rm -rf). g2data/ is a managed folder. if you start tinkering yourself with it, g2 doesn't know about it and you can get unexpected errors.

3. of course g2 keeeps track of these things. don't delete stuff in the db / in the filesystem manually. you should use use G2's API (GalleryCoreApi) to delete users, albums, ..

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

 
hjho

Joined: 2005-10-22
Posts: 15
Posted: Sat, 2007-02-24 08:36

Ok. I see. Which API method (below) shall I call to permenantly remove the directory? Based on the Embed API, I can't seem to identify anything that looks relavent to "remove user durectory". Or is there a way to remove the user's directory during the user deletion?

* addExternalIdMapEntry
* addUserToGroup
* checkActiveUser
* createGroup
* createUser
* deleteGroup
* deleteUser
* done
* getApiVersion
* getExternalIdMap
* getImageBlock
* getSessionId
* handleRequest
* init
* isCompatibleWithEmbedApi
* isExternalIdMapped
* login
* logout
* parseHead
* removeUserFromGroup
* search
* searchScan
* updateGroup
* updateUser
* _restoreState
* _saveState
* _setUserData

 
DaFoot

Joined: 2007-04-30
Posts: 15
Posted: Thu, 2008-12-11 10:36

Resurrecting an old thread here....

In a reply above it seems it is advisable to reassign a user's images/albums to another (admin) user before deleting the user.

Does anyone know how I can reassign album/image owner using the embedded gallery2 API?