forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: fribse on October 20, 2010, 03:34:47 pm

Title: Clean out old photos from database?
Post by: fribse on October 20, 2010, 03:34:47 pm
I've posted this under 1.4/misc as well, but I've moved the gallery to 1.5, so this is probably a better place to post it.
After I've renamed some folders that contained pictures already included in albums, it still has the old picturesit fails to load.
I need to have them cleaned out from the database, some sort of 'validate all pictures' would be great, or at least clear out an album for all pictures, so I can readd them.
Title: Re: Clean out old photos from database?
Post by: Αndré on October 20, 2010, 04:17:54 pm
Afaik Coppermine don't has such a mechanism. But you could write a simple script that deletes database entries if the file_exists function detects missing files.
Title: Re: Clean out old photos from database?
Post by: hobert on October 21, 2010, 04:01:24 pm
Here's a small mod I wrote for 1.4 that will automatically check the "delete" box in editpics.php if the original file source is missing.  It's still working fine in 1.5.8 as far as I can tell.

This will also get rid of the thumbnail and other pictures if they are left behind.

http://forum.coppermine-gallery.net/index.php/topic,61925.0.html (http://forum.coppermine-gallery.net/index.php/topic,61925.0.html)
Title: Re: Clean out old photos from database?
Post by: fribse1 on October 22, 2010, 07:33:54 am
Very neat mod, but I can't get it working.
Problem is very strange.
If I go to 'edit files' it ONLY lists the files that are really there, not the bad ones that are missing??? So it doesn't show any checkmarks for deleting them :-(
I think the database has gone haywire over this.
I wonder if it will allow me to delete the album in it's enitirity, and just bulk add them back in...
Title: Re: Clean out old photos from database?
Post by: fribse on October 29, 2010, 09:13:56 am
Can anybody tell me how to directly manipulate the database to completely remove the album (I'll just readd the album afterwards with batch load).
Title: Re: Clean out old photos from database?
Post by: Αndré on October 29, 2010, 09:28:41 am
If you want to remove the files of an album, you'll have to delete the appropriate entries (have a look at the column 'aid') in the pictures table.
If you want to remove the album, too, you'll have to delete the entry in the albums table.
According to your Coppermine setup you'll have to clean the comments table and maybe the stats tables, too.
Title: Re: Clean out old photos from database?
Post by: fribse on October 31, 2010, 01:40:49 pm
Excellent, got them removed, now on to adding them back in  ;D
Thanks!
Title: Re: Clean out old photos from database?
Post by: Αndré on October 31, 2010, 04:19:39 pm
Please mark your thread as solved when it's solved: http://forum.coppermine-gallery.net/index.php/topic,55415.msg270631.html#msg270631