Need SQL to bulk delete albums

techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 17:23

Hi - I've searched not only here but all over the web. All I need is the SQL to bulk delete albums from my MySql database. I have like 2000 of them that spammers put in and the multiple delete button only shows 15 at a time.

BTW, I do have many years of experience with MySql, so I'll know what I'm doing.

Can someone help?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-22 20:54

It would be quicker to change the multiple delete page to show more items. You're not recommended to muck about in the database; it's pretty complex.

 
techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 20:56

I would love to do that. Where is that setting?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-22 21:05

Probably in the relevant template file.

 
techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 21:06

No idea where this would be. Can you help?

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-22 21:08

Actually no - try line 172 of modules\core\itemDelete.inc:

Quote:
$form['numPerPage'] = 30;

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2010-04-22 21:09

I don't know. I believe you're using an older version of G2 that still allowed you to delete multiple albums. The most recent versions 2.3 and 2.3.1 do not allow that as it's very resource intensive. IIRC that was my conversation with Bharat when I asked about it when I noticed that option was gone.

I'd dig around in /modules/core/templates
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 21:09

You're awesome, will try this.

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Thu, 2010-04-22 21:13

um, just ignore my post :)
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

 
techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 21:13

I don't care if it's intensive - there are not that many users. But I appreciate the concern.

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-22 21:17
Quote:
um, just ignore my post

...which was (I have no doubt) actually referring to the forthcoming (but Ultra Ultra Secret) Gallery 2.4 release :-D ... since my 2.3 has no problem deleting multiple albums - although, yes, it does take an age (and doesn't have a progress bar either).

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2010-04-22 21:22

I've also just recalled why deleting items by hitting the db is a bad idea, and why nobody can give you a safe SQL statement for that purpose: individual modules have their own tables that reference GalleryItems and install event hooks so that they are notified to run their own code to tidy up during the item (or album) deletion process. So the db changes can depend on what modules you have installed.

Besides which, deleting a photo is 6 table join, even without additional modules.

 
techaritst

Joined: 2010-04-22
Posts: 6
Posted: Thu, 2010-04-22 21:24

Spoke too soon. Cache hadn't cleared.

Thx