How to bulk delete comments?
teddink
![]()
Joined: 2006-06-22
Posts: 7 |
![]() |
Gallery version = 2.1.2 core 1.1.0.2 Unfortunately I left the ability for guest to comment on the root album. I eneded up with 350 or so comments on the root album. Is there an easy way to bulk delete all of the comments for a particular album? Needless to say that deleting them one at a time will get very tiresome... Thanks in advance. |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
there's no interface for that yet. you can file a feature request for it. if you decide to manually delete the comments in the database, don't forget the g2_Entity and g2_ChildEntity tables which hold a row for each row in g2_Comment. |
|
teddink
![]()
Joined: 2006-06-22
Posts: 7 |
![]() |
Done - thanks for the verification and the suggestion. I may try the direct DB deletion method in the meantime. |
|
Murple
Joined: 2005-12-07
Posts: 14 |
![]() |
That seems a pretty glaring lack. |
|
eduo
Joined: 2003-09-10
Posts: 107 |
![]() |
Has anything for this done yet in 2.2? I have looked around and can't find anything. I see here (http://gallery.menalto.com/node/33894) that a hack existed once for this in Gallery 1, and also there has been lots of requests for some way to bulk delete comments (there was in G1). I may be missing this functionality if it has indeed been added since I last checked. Eduo |
|
austris
Joined: 2006-03-16
Posts: 17 |
![]() |
haven't found anything for 2.2. 1) browse the g2_comment table to find range of g_id's that you want to delete (in my case there are ~15 spam comments a day from various IPs despite the fact that I have captcha module enabled for anonymous comments). Take a not of min/max values of the IDs - ID_MIN, ID_MAX for good or for bad, but legal commenters are rather inactive in my galleries, so it's usually just a single range that needs to be deleted to get rid of the spam comments. cheers, |
|
valiant
Joined: 2003-01-04
Posts: 32509 |
![]() |
that's a very dangerous and error-prone way to do it. please don't do it this way. -------------- |
|
yottabit
Joined: 2004-02-25
Posts: 36 |
![]() |
okay, so deleted the Comment rows without deleting the entries from the Entity and ChildEntity tables... Any advice? :o) |
|
austris
Joined: 2006-03-16
Posts: 17 |
![]() |
that's why valiant asked you to not do it this way ;) I'm not SQL expert, so it might be not most effective way, but I would fix it as follows: delete the id's from both tables. I used following SQL: |
|
austris
Joined: 2006-03-16
Posts: 17 |
![]() |
ok, I got the same problem in the different instance of gallery, so I came up with something better. to delete by IP: to delete by content: to delete by author: of course, you can combine IP with content and/or author if you wish. and this will delete it in a single sql, so yottabit won't have the same problem next time cheers, |
|
sleze
Joined: 2004-05-08
Posts: 15 |
![]() |
I went into MyPHP and found all the records of the few hundred comment spams and deleted them. Now when I attempt to view latest comments of certain folders, I get a SQL error: Error (ERROR_MISSING_OBJECT) : Missing object for 12 in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 1887 (GalleryCoreApi::error) in modules/core/classes/GalleryStorage/GalleryStorageExtras.class at line 98 (GalleryStorageExtras::_identifyEntities) in modules/core/classes/GalleryStorage.class at line 298 (GalleryStorageExtras::loadEntities) in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 71 (GalleryStorage::loadEntities) in modules/core/classes/GalleryCoreApi.class at line 2251 (GalleryEntityHelper_simple::loadEntitiesById) in modules/comment/ShowAllComments.inc at line 73 (GalleryCoreApi::loadEntitiesById) in modules/core/classes/GalleryView.class at line 300 (ShowAllCommentsView::loadTemplate) in main.php at line 441 (GalleryView::doLoadTemplate) in main.php at line 94 in main.php at line 83 I think for some reason, Gallery is still looking for those comments. You can tell by going to my gallery homepage and clicking "Latest Comments." The first page is fine but when you click next, you will see "not found." Admins see the above detail. I have tried to delete the database cache and I got the following results: Unable to delete directory: ...gallery/g2data/cache/entity Unable to delete directory: ...gallery/g2data/cache/theme Unable to delete directory: ...gallery/g2data/cache/module When I tried to delete the template cache, I get THIS error: Unable to delete directory: ...gallery/g2data/smarty/templates_c/ Anyone have any ideas as to how to fix it? |
|
sleze
Joined: 2004-05-08
Posts: 15 |
![]() |
Fixed the delete problem by playing with permissions but I still have the not-found issue with viewing latest comments. |
|
yhager
Joined: 2007-12-09
Posts: 1 |
![]() |
I had quite a success using CommentBlaster, after failing one of the SQL queries above. |
|
spurrymoses
Joined: 2004-02-22
Posts: 12 |
![]() |
uhuru53
![]()
Joined: 2006-12-02
Posts: 94 |
![]() |
yhager wrote:
I had quite a success using CommentBlaster, after failing one of the SQL queries above. Thanks for suggesting this script! |
|
nnnortonian
Joined: 2010-01-13
Posts: 1 |
![]() |
Script works great. Thanks! |
|