Closing Old Comments

The other night I decided that I wanted to figure out how to turn off comments on old entries. I figured that would be a good way to stop some of the comment spam I’ve been getting. I didn’t want to totally turn off comments because for the handful of people who come here I wanted them to be able to comment if the mood struck.

Since I am not the brains behind the organization, and I did look in my config file, I asked the better-half to flip the switch for me. Alas, it wasn’t as easy as I thought. There is a lovely hack out there but if you are using the Berkeley database it doesn’t work. The better-half modified a hack and I asked him to explain what he did.


From the Goat himself:

This is a terribly hacked-up modification of Timothy Appnel’s mt-closure.

Try his work first, and if it doesn’t work, and you’re feeling especially adventurous, try this. Why use his work first? His original has command-line options, flexibility…

Why aren’t we using his work? It didn’t function with our MT installation– and I spent a couple of hours trying to figure out why. It has been years since I worked with Perl, and until now, I’d never read any of MT’s programming documentation. End result– the MT::Entry->load() stuff in mt-closure2.pl is a modified version of an example in the MT::Object documentation.

Note that this code is intended to do one thing… close the comment threads on all blog entries that we created >= 30 days before the script is run. It does this on all blogs that are hosted within a single Moveable Type install. No exceptions, no handholding, no excuses :-)

It will not turn off trackbacks, it has no command-line options, and there’s no “do-it-for-one blog and not the others”… and obviously, there’s no warranty. You’d be crazy to run this script.

But both of us are crazy, so we’ve got this puppy set up to run every day.

Here’s the script.

This entry was posted in Thinking. Bookmark the permalink.