Around 3am this morning, I got to wondering what it'd take to write a command-line script that, given a post id number, would cause MT to regenerate it. The reason I need this (at least as a stepping stone) is that in my quest to remove blog pop-ups I neglected to notice that MT doesn't rebuild the entry page upon receiving a TrackBack ping--only when a comment is posted. This was pointed out by several folks in the comments. Someone even pointed to a patch that fixes this.

Instead, I wanted a way to do this without relying on a patch that may or not still work after the next MT upgrade. So I did a bit of poking around and read some of the MT perl module documentation. What I found made me very happy.

  1. MT is very well documented, from a programmer's point of view
  2. MT is very well designed, from a programmer's point of view
  3. Doing simple things in MT really is simple

With that in mind, I created a few test scripts before settling upon what I wanted. I devised a script called rebuild_recent.pl. Given a number (N) on the command-line, it rebuilds the N most recent entries. Have a look. It's really quite simple. Just drop it in your MT directory and it'll work.

Now I mentioned that this is a stepping stone. Since I recently moved from Berkeley DB to MySQL for the back-end, I'm going to rig up a cron job that scans for recent TrackBack pings and rebuilds affected entries. If I run it every 2-10 minutes, that should be sufficient.

Kudos to Ben and Mena for a great product that's also hacker friendly.

Posted by jzawodn at June 09, 2003 11:47 AM

Reader Comments
Disclaimer: The opinions expressed here are mine and mine alone. My current, past, or previous employers are not responsible for what I write here, the comments left by others, or the photos I may share. If you have questions, please contact me. Also, I am not a journalist or reporter. Don't "pitch" me.

 

Privacy: I do not share or publish the email addresses or IP addresses of anyone posting a comment here without consent. However, I do reserve the right to remove comments that are spammy, off-topic, or otherwise unsuitable based on my comment policy. In a few cases, I may leave spammy comments but remove any URLs they contain.