commentblaster.php end with rollback?

patrikhson

Joined: 2005-12-23
Posts: 15
Posted: Sun, 2008-06-15 08:23

I am trying to remove comments in Gallery 2.2.3 with the commentblaster.php script, but no comments seems to be removed. Yes, I have changed the dry-run global parameter.

It ends with a rollback...why?

Here I changed the number 500 to 1, so that only one comment is to be removed (out of the ~86000), to make output shorter.

(mysqlt): SELECT COUNT(g2_Comment.g_id) FROM g2_Comment
There are 82296 comments
(mysqlt): SELECT g2_Comment.g_id FROM g2_Comment LIMIT 1
getParameter lock.system for core plugin fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/78639, wb+, 0) flock(Resource id #57, 6, ) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.inc)
(mysqlt): SELECT g_id, g_entityType FROM g2_Entity WHERE g_id IN (78639)
file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/_all/0/0/GalleryStorage_describeEntity.inc)
(mysqlt): SELECT g2_Comment.g_commenterId, g2_Comment.g_host, g2_Comment.g_subject, g2_Comment.g_comment, g2_Comment.g_date, g2_Comment.g_author, g2_ChildEntity.g_parentId, g2_Entity.g_id, g2_Entity.g_creationTimestamp, g2_Entity.g_isLinkable, g2_Entity.g_linkId, g2_Entity.g_modificationTimestamp, g2_Entity.g_serialNumber, g2_Entity.g_entityType, g2_Entity.g_onLoadHandlers FROM g2_Comment, g2_ChildEntity, g2_Entity WHERE g2_Comment.g_id IN (78639) AND g2_ChildEntity.g_id=g2_Comment.g_id AND g2_Entity.g_id=g2_Comment.g_id
file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8) is_dir(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8) is_dir(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8) getParameter permissions.file for core plugin getParameter permissions.directory for core plugin rename(/usr/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.incNPlWJU, /local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.inc)
(mysqlt): SELECT g2_ItemAttributesMap.g_itemId, g2_ItemAttributesMap.g_parentSequence FROM g2_ChildEntity, g2_ItemAttributesMap WHERE g2_ChildEntity.g_id = 78639 AND g2_ChildEntity.g_parentId = g2_ItemAttributesMap.g_itemId
fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/7, wb+, 0) fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/78778, wb+, 0) fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/77169, wb+, 0) fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/78599, wb+, 0) fopen(/local/gallery2/sites/stupid.domain.name/g2data/locks/78636, wb+, 0) flock(Resource id #66, 5, ) flock(Resource id #67, 5, 0) flock(Resource id #68, 5, 0) flock(Resource id #69, 5, 0) flock(Resource id #70, 5, 0)
(mysqlt): SELECT g2_Entity.g_id FROM g2_Entity WHERE g2_Entity.g_linkId = 78639 ORDER BY g2_Entity.g_id ASC
file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc) Loading plugin albumselect Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/albumselect/module.inc) albumselect plugin successfully instantiated Loading plugin comment Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/comment/module.inc) comment plugin successfully instantiated Loading plugin customfield Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/customfield/module.inc) customfield plugin successfully instantiated Loading plugin hidden Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/hidden/module.inc) hidden plugin successfully instantiated Loading plugin httpauth Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/httpauth/module.inc) httpauth plugin successfully instantiated Loading plugin imageblock Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/imageblock/module.inc) imageblock plugin successfully instantiated Loading plugin migrate Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/migrate/module.inc) migrate plugin successfully instantiated Loading plugin password Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/password/module.inc) password plugin successfully instantiated Loading plugin permalinks Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/permalinks/module.inc) permalinks plugin successfully instantiated Loading plugin rating Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/rating/module.inc) rating plugin successfully instantiated Loading plugin rewrite Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/rewrite/module.inc) rewrite plugin successfully instantiated Loading plugin rss Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/rss/module.inc) rss plugin successfully instantiated Loading plugin watermark Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/watermark/module.inc) watermark plugin successfully instantiated Loading plugin webdav Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/webdav/module.inc) webdav plugin successfully instantiated Loading plugin core Class not defined, trying to include it. file_exists(/usr/local/gallery2/gallery2-base/modules/core/module.inc) core plugin successfully instantiated
(mysqlt): SET AUTOCOMMIT=0
(mysqlt): BEGIN
(mysqlt): DELETE FROM g2_CustomFieldMap WHERE g_itemId=78639
(mysqlt): DELETE FROM g2_CacheMap WHERE g_itemId IN (78639,78636)
(mysqlt): DELETE FROM g2_PluginParameterMap WHERE g_itemId=78639
file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/albumselect/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/archiveupload/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/captcha/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/colorpack/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/comment/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/customfield/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/dcraw/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/debug/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/dynamicalbum/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/exif/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/getid3/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/hidden/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/httpauth/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/icons/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/imageblock/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/imageframe/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/imagemagick/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/itemadd/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/keyalbum/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/members/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/migrate/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/newitems/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/nokiaupload/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/panorama/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/password/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/permalinks/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/picasa/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/publishxp/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/rating/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/rearrange/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/remote/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/replica/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/reupload/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/rewrite/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/rss/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/search/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/sitemap/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/slideshow/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/slideshowapplet/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/uploadapplet/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/watermark/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/webcam/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/webdav/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/register/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/flashvideo/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/netpbm/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/useralbum/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/sizelimit/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/ecard/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/gd/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/multilang/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/multiroot/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/ffmpeg/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/photoaccess/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/thumbpage/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/zipcart/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/thumbnail/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/core/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/cart/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/shutterfly/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/linkitem/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/fotokasten/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/mp3audio/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/mime/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/squarethumb/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/randomhighlight/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/digibug/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/module/quotas/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/_all/0/0/GalleryPluginHelper_fetchPluginStatus.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/ajaxian/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/carbon/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/classic/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/matrix/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/hybrid/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/slider/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/siriux/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/floatrix/7/8/78639.inc) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/theme/tile/7/8/78639.inc)
(mysqlt): DELETE FROM g2_AccessSubscriberMap WHERE g_itemId=78639
(mysqlt): DELETE FROM g2_Comment WHERE g_id=78639
(mysqlt): DELETE FROM g2_ChildEntity WHERE g_id=78639
(mysqlt): DELETE FROM g2_Entity WHERE g_id=78639
file_exists(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.inc) is_dir(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.inc) unlink(/local/gallery2/sites/stupid.domain.name/g2data/cache/entity/7/8/78639.inc) 78639... fclose(Resource id #57) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/78639) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/78639) fclose(Resource id #66) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/7) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/7) fclose(Resource id #67) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/78778) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/78778) fclose(Resource id #68) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/77169) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/77169) fclose(Resource id #69) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/78599) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/78599) fclose(Resource id #70) file_exists(/local/gallery2/sites/stupid.domain.name/g2data/locks/78636) unlink(/local/gallery2/sites/stupid.domain.name/g2data/locks/78636)
(mysqlt): ROLLBACK
(mysqlt): SET AUTOCOMMIT=1

System Information
Gallery version 2.2.3
PHP version 5.2.5 apache
Webserver Apache/1.3.39 (Unix) mod_perl/1.30 PHP/5.2.5 with Suhosin-Patch mod_fastcgi/2.2.2 mod_ssl/2.8.30 OpenSSL/0.9.7e-p1
Database mysqlt 5.0.45-log
Toolkits ImageMagick
Operating system FreeBSD charles.frobbit.se 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 10:40:27 UTC 2007

:/usr/obj/usr/src/sys/GENERIC i386
Browser Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.20

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2008-06-15 09:22

Ah, that's because the script wasn't written very well (it was written as a one-off to fix a problem here on this site). Try adding this line:

GalleryEmbed::done();

after the call to blastAll() (and after the error checking) so that it looks something like this:

$ret = blastAll();
if ($ret) {
    print $ret->getAsHtml();
}
GalleryEmbed::done();
 
patrikhson

Joined: 2005-12-23
Posts: 15
Posted: Sun, 2008-06-15 12:56

That did the trick (i.e. added a COMMIT).

Thanks!

Patrik

 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2008-06-15 19:02

Great! I've updated the CommentBlaster script to include those lines so that others won't have this problem.

 
patrikhson

Joined: 2005-12-23
Posts: 15
Posted: Sun, 2008-06-15 19:29

FYI: I also had some problems with the large number of lock files that where opened. So increasing the number from 500 to a much larger did not work very well. I because of this edited part of the script to be the following. I have no idea whether there is a simpler/easier way of doing a commit.

For those that do not completely understand, this hack will remove all comments in chunks of 500. Also, fetching this with a web client does not work very well either as the amount of output will be, hmm, large. Using things like curl work much better (on the client side).

function blastAll() {
    list ($ret, $count) = getCount();
    while($count > 0) {
      if ($ret) {
        return $ret->wrap(__FILE__, __LINE__);
      }

      flushprint("There are still $count comments to be removed");

      $ret = blast(500);
      if ($ret) {
        return $ret->wrap(__FILE__, __LINE__);
      }
      GalleryEmbed::done();
      list ($ret, $count) = getCount();
    }
    return null;
}
 
bharat
bharat's picture

Joined: 2002-05-21
Posts: 7994
Posted: Sun, 2008-06-15 20:11

In the new version, I turned off the debugging option that makes the debug output so verbose. Now it's much cleaner.

Putting GalleryEmbed::done() in the middle of the loop is probably not a great idea, since that function is supposed to be called once to terminate your embedding session. It'll work for now, but it may break in the future. For anybody else following along, I suggest that you do this instead:

        global $gallery;
        if ($gallery->isStorageInitialized()) {
            $storage =& $gallery->getStorage();
            $ret = $storage->commitTransaction();
            if ($ret) {
                return $ret;
            }
        }
 
kc5cbt

Joined: 2010-08-09
Posts: 1
Posted: Mon, 2010-08-09 17:26

I was using commentblaster to delete comments, now when I goto main.php I only get "Error". Any ideas how to restore my gallery?

 
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 16504
Posted: Mon, 2010-08-09 17:52

That error is usually indicative of database connection issues. To get more information, put Gallery into debug mode:
FAQ: How to set/use Gallery in debug mode?

Copy and paste the debug output from the main screen NOT the Smarty debug window into a text file and attach to this thread.
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here