Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Delete Empty Albums?  (Read 3430 times)

0 Members and 1 Guest are viewing this topic.

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Delete Empty Albums?
« on: September 08, 2006, 06:57:44 pm »

CPG 1.4.9 -- brand new fresh install, too.  Very, spiffy, folks!
MySQL 4.1.7
PHP 5.1.1
Win 2003 Server

I've done a lot of moving and other changes to my Gallery and there are a lot of albums that are now left with zero pictures.  Is there any way of deleting all these albums with zero pictures, other than clicking the "delete" button for each album?  I do have phpMyAdmin ....

Thanks in advance!

==========

Background:

I read Stramm's post (I DO use the Search Engine!  I do!):

delete the albums and pictures in them and the user galleries category disappears
to delete empty albums
http://forum.coppermine-gallery.net/index.php?topic=31917.msg148529#msg148529

and went to the linked thread, where it says ...

if the album is empty you won't see it. For that click 'properties' next to any visible (public) album. Now you'll see a dropdown box on the top right side. Look for user galleries here. User galleries can be found looking for () and the users name in it. Like '(Stramm) My Album'. Select the album, then click 'parent category' (left of the dropdown). Magic... you'll now see the empty album and can hit the 'delete' button

... however, as you can see, you can still see the empty albums, even if you're not logged in.  Probably this is because I (Administrator) uploaded these albums.
« Last Edit: September 08, 2006, 07:29:25 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Delete Empty Albums?
« Reply #1 on: September 08, 2006, 07:04:36 pm »

This should do it. Backup first.

Code: [Select]
DELETE FROM a USING cpg_albums AS a LEFT JOIN cpg_pictures AS p ON p.aid = a.aid WHERE p.pid IS NULL
Not a plugin contribution, moving.
Logged

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Re: Delete Empty Albums?
« Reply #2 on: September 08, 2006, 07:11:05 pm »

Thanks for moving.  Sorry.  Too many browser windows open.
Logged

Nibbler

  • Guest
Re: Delete Empty Albums?
« Reply #3 on: September 08, 2006, 07:19:43 pm »

Just to note:If you use the 'linked files' feature then don't use the above.
Logged

Prisoner_24601

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 47
Re: Delete Empty Albums?
« Reply #4 on: September 08, 2006, 07:20:35 pm »

I think that worked!  Deleted 194 entries, which "sounds" about right.  Thanks very much: saved a lot of time!

Another note to anyone else that tries this: where Nibbler has "cpg_", make sure you substitute the correct prefix for your tables!  Mine's "cpg143_".
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.