SQL Querry to delete EVERY comment?

Barnister

Joined: 2009-03-04
Posts: 36
Posted: Mon, 2010-03-22 08:38

Howdy, can somebody give me the code for the SQL querry to delete EVERY comment made on my gallery? Deleting 240 spam, one by one ain't fun!

Thanks

 
mamouneyya

Joined: 2009-11-02
Posts: 337
Posted: Mon, 2010-03-22 15:24

Do you have phpMyAdmin? I think dropping all 'comments' table contents will just do the job, but I'm no so sure so please make a *backup* if you're going to try that.

 
Barnister

Joined: 2009-03-04
Posts: 36
Posted: Mon, 2010-03-22 21:32

Yea I do, but I'm really not in the mood to backup, test, fail, load backup, test, fail, load backup, rinse and repeat. Anything concrete?

 
rWatcher
rWatcher's picture

Joined: 2005-09-06
Posts: 619
Posted: Wed, 2010-03-24 05:54

** This is untested, proceed at your own risk **

If I were going to delete every comment in my gallery (which I'm not, so this isn't tested) I would do the following:
- Deactivate the comments module from the Gallery 3 admin screen
- Use phpMyAdmin (or something similar) to locate the record in the gallery 3 modules table for the comment module and then delete the record (this _should_ make gallery think that the module was never installed)
- Use phpMyAdmin to completely delete the comments table
- Activate the comment module from the Gallery 3 admin screen (when gallery checks the modules table and can't find any references to the comment module, it _should_ re-run the installer for the module and re-create a brand new, completely empty comments table).

Like I said, I didn't test this, so you really should make a backup first...

 
xale

Joined: 2010-04-19
Posts: 3
Posted: Mon, 2010-04-19 15:32

i wonder why just deleting all the rows in the "comment" table should not work...

looking at its columns it doesn't look any other table should need it...

I got some 2000 comments in one day... it would be nice to be able to delete them without going to php myadmin...

i'm doing a copy of the comment table and recreate one without content... wish me good luck!

 
xale

Joined: 2010-04-19
Posts: 3
Posted: Mon, 2010-04-19 15:39

so using gallery 3 rc1:
- go to phpmyadmin and choose your database
- export the structure of the comments table and copy the sql query
- rename the comments table to anything not used yet in your database
- run the copied query by pasting it into the sql tab

on my system it worked:
- the management > content > comments tab is empty
- i can view the albums and photos, i can add new comments...

as usual: use this suggestion at your own risk!

i don't see any reason why it should fail, and it didn't fail on my system... your experience may vary, though!