Hello all,
After dealing with a bunch of comment spam and deciding that I no longer wanted to deal with ANY comments, a friend of mine came up with this quick perl script (it requires a special module, that you can download)
You run it on your albums.dat file: rmcomments <albums.dat >albums.new.dat
#!/usr/bin/perl -w
# tristan+perl@ethereal.net 3jan2008
use strict;
use PHP::Serialization qw(serialize unserialize);
local $/;
local $_ = <>;
my $a = unserialize $_;
for (@$a) {
delete $_->{comments};
}
#use Data::Dumper;
#print Dumper $a;
print serialize $a;
Posts: 6818
Thanks!
Jens
--
Last Gallery v1 Developer.
Tryout the TEST-Version of Gallery 1.6
Posts: 1
This was a great email and has inspired me to extend the program so that it asks you what you want to do for each comment rather than delete everything. I didn't want to risk deleting real comments.
Syntax: rmcomments --in <filename> --out <filename>
Two more options:
--default yes This will switch the default if you press return at the prompt to delete the comment
--no-autobad This will turn off the automatic deletion of comments with bad words in them
The regexp in the code should be modified to suit your definition of bad words if you use the autobad feature.
James
Posts: 6
Squish0's version worked as advertised for the deep infestation of comment spam on one of my albums.
Thanks!
Jeff G.
Posts: 3
Thanks for the script.I have been wondering for this perl script.
Thank you.