Rebuilding individual archives when pinged

I’ll be breaking my TrackBack pretty thoroughly for a bit, and then possibly breaking it for some people for a while, trying to persuade MT to rebuild my individual archive page for an entry when it gets pinged.

Update: unless I’m missing something, that didn’t take long.

The problem: when you receive a TrackBack ping, Movable Type needs to do everything it does with the ping before it sends a reply to the person who pinged you, so that it can tell them whether or not the ping worked. That sets a time limit on how much it can do, before their program decides that the ping has taken too long and gives up. So MT adds the ping to your database, rebuilds the RSS file for that entry’s pings, rebuilds all your index templates in case they have TrackBack counts in them, mails you a notification, and calls that good enough. It doesn’t try to rebuild archives, in case it takes too long to get that done, which is a problem for those of us who don’t like popups, and display our TrackBack pings on the individual archive page with the comments.

So far, the three solutions I’ve see are: my solution, which involves using PHP to include the output from the CGI program the popup calls, with the template stripped down to just the stuff I want included in the page; the direct solution of having PHP get the TrackBack data from your MySQL database without going through MT at all; one I haven’t seen done, using PHP to parse the RSS file of pings and include that in the page; or the manual solution of rebuilding yourself when you get an email TrackBack notification. The first three solutions are tolerable, but not very slick; the fourth is too much trouble to suit me, and is likely to get you pinged multiple times, if you aren’t there to rebuild when someone thinks their ping didn’t go through since they don’t see it on the page.

If you have a fair amount of faith in the speed of your rebuilds (or in your TrackBackers’ willingness to keep trying, or to let you know that there’s a problem), you can hack in support for rebuilding archives, or just rebuilding the individual entry page for the entry that was pinged. Fairly obviously, this isn’t a hack for the faint of heart.

First, you might want to save a backup copy of {your MT directory}/lib/MT/App/Trackback.pm, to save yourself the trouble of redownloading it when things go south. Then, look for the lines (starting at 199 in my copy):

    $app->rebuild_indexes( Blog => $blog )
        or return $app->_response(Error =>
            $app->translate("Rebuild failed: [_1]", $app->errstr));

and directly below that add:

    if ($tb->entry_id) {
      $app->rebuild_entry( Entry => $entry, BuildDependencies => 0 )
          or return $app->_response(Error =>
            $app->translate("Archive rebuild failed: [_1]", $app->errstr));
    }

That will rebuild all the archive files for the entry that was pinged, individual, date-based, and category, so if you have TrackBack counts in all of your archive types that’s probably what you want, but that’s the sort of rebuild that Ben expected would take long enough that pings would time out. If all you want is to rebuild the individual archive page for the entry, use:

    if ($tb->entry_id) {
      $app->_rebuild_entry_archive_type( Entry => $entry, ArchiveType => "Individual")
          or return $app->_response(Error =>
            $app->translate("Archive rebuild failed: [_1]", $app->errstr));
    }

and then post a message along the lines of:

I’m experimenting with rebuilding individual archives when an entry gets a TrackBack ping. If you have trouble pinging me, please let me know about it. Also, you might try setting a longer value for PingTimeout in your mt.cfg file.

and let me know how it works for you, and feel free to ping this entry mercilessly to see how it works for me.

66 Comments

Comment by Reverend Jim #
2002-12-18 22:32:33

I have the same problem. If you do figure out how to persuade it, please let us all know how you did it.

 
Comment by Mark #
2002-12-19 15:00:07

You can also do it with server-side includes, if your ISP allows them. In your .htaccess file, set

Options +Includes

Then in your individual archive template, put this where you want the inline trackbacks to go:

<MTEntryIfAllowPings>
<!–#include virtual=”<$MTCGIPath$><$MTTrackbackScript$>?__mode=view&entry_id=<$MTEntryID$>” –>
</MTEntryIfAllowPings>

Then change your trackback template so it just includes the actual stuff you want to display inline (i.e. it’s not a full web page anymore, so no HTML or HEAD tags, etc.)

Comment by Thomas #
2003-08-19 14:05:34

oh cool , it works - thanks tom

 
 
Comment by Phil Ringnalda #
2002-12-19 20:24:44

Yeah, including the cgi works, but it doesn’t please me anymore like it did when I first started using it. It’s not pretty, and worse yet it’s standing in the way of my being able to treat TrackBacks as remote comments, intermingled with the local comments in the right chronological order. We’ll see whether my Perl lack-of-skillz are up to the task (especially since I half finished it in August and then forgot everything I’d done when I realized I’d need the archives to rebuild), but that’s what I’ve got in mind. So far, looks like it’s working okay: thanks to some reshuffling and rebuilding that got me repinged, plus some new pings, I’ve gotten a half-dozen without any reports that I’m unpingable. Fingers are crossed.

 
Trackback by markpasc.org #
2002-12-24 13:04:01

Rebuilding pages for Trackback

Toying with Movable Type’s Trackback feature.

 
Comment by Mark Paschal #
2002-12-24 13:13:51

Oops:

TrackBacks

Warning: Failed opening ’http://philringnalda.com/mt/mt-tb.cgi?__mode=view&entry_id=2421’ for inclusion (include_path=’.:/home/.quin/philor/philringnalda.com/phplib/pear:/home/.quin/philor/philringnalda.com/phplib/pear/PEAR’) in /home/.quin/philor/philringnalda.com/archives/002421.php on line 197

 
Comment by Mark Paschal #
2002-12-24 13:15:22

Only now not so much.

 
Comment by Phil Ringnalda #
2002-12-24 13:30:05

NightmareHost identified a vulnerability in their MySQL servers yesterday, so they’ve been making them safe by making them unavailable: chances are you caught a moment when PHP couldn’t include the CGI because the CGI couldn’t do jack because it couldn’t connect to the DB. That’s my guess anyway. So far I haven’t heard from anyone that a ping failed, though Ghu knows everything else around here is failing off and on.

 
Comment by Phil Ringnalda #
2002-12-24 13:39:30

Oh, that ping did more-or-less fail, didn’t it? Just noticed that it didn’t build the TrackBack RSS file or send the email notification, which means that it died while rebuilding (not unusual with NightmareHost, though, the way it’ll sometimes die instantly when you post a comment or save an entry. Too bad I’m too lazy to move out.)

 
Comment by Mark Paschal #
2002-12-24 16:15:03

Well, it posted here as far as I could tell. Can’t really tell from this end.

 
Comment by Phil Ringnalda #
2002-12-24 16:29:45

It’s not still in the ”URLs to ping” textarea for the entry? I can’t figure any way that it could fail to build or email without returning an error to you or timing out, so MT should still be patiently waiting for you to save that entry again, at which point it’ll try to ping again.

 
Trackback by Burningbird #
2003-01-05 08:47:33

Adding Trackback entries to individual archive pages

I’m firing on all one cylinder today. Sam Ruby references a citation at Simon Willison, who quotes Tantek: ”…we now have Trackback and Pingback to help automate generating comment hyperlinks to blog-on-blog commentary. While I certainly applaud these…

 
Trackback by Antipixel #
2003-01-19 05:47:41

Trackbackin’

Antipixel is now, the gods willing, TrackBackable.

 
Trackback by Antipixel #
2003-01-19 05:47:46

Trackbackin’

Antipixel is now, the gods willing, TrackBackable.

 
Comment by jh #
2003-01-19 05:49:34

Duh… I turned on TrackBack auto-discovery and then went ahead and manually added the URL to be pinged. So you were pung twice. Sorry, I get it now. Honest.

-jh

 
Trackback by chriscassellDotNet #
2003-01-20 12:05:48

Trackback Auto-rebuild

It’s funny how often someone solves a problem that I’ve been thinking about at virtually the same time I’m thinking

 
2003-01-24 08:32:08

Individual Entry RSS feeds

With a little help from this post by Phil Ringnalda and a lot of customization, I have now implemented

 
2003-01-24 08:45:52

MoveableType Trackback broken?

Here’s a curiosity. Often times, when Moveable Type sends a Trackback ping to another site, the receiving server will

 
Trackback by The Long Letter #
2003-01-25 14:39:25

MT upgrades

I’ve just added a new plug-in to MovableType — SmartyPants. It’s a relatively minor thing, but one that’s nice to have — it automatically converts common characters into their typographically-correct versions. I’ve also hacked into the code…

 
Comment by Joshua Kaufman #
2003-02-14 06:49:09

Phil: same hack for 2.51?

Thanks.

 
Comment by Joshua Kaufman #
2003-02-14 06:52:04

Also, slightly related, did you have to add a hack so that your TrackBacks and Comments intermingle as they do on this post. I’m talking about how you list a trackback, another trackback, then a comment, then another trackback. How does that work? Thanks again.

 
Comment by Phil Ringnalda #
2003-02-14 07:35:24

Joshua: I’m not sure yet. I foolishly didn’t put this post in my MT Hacks category, which is where I look after an upgrade, so I didn’t check last night, and this morning (which is no-time-to-spare morning), I just noticed that my comment RSS feeds have the closing tag of a CDATA section after the comment body (without the opening tag), so they are rather completely broken. With a little luck, I’ll get that this morning, and check/fix this tonight.

Meantime, no, the intermingled comments and trackbacks are just Adam Kalsey’s SimpleComments plugin - no hacking, just drop in a plugin and change a couple of tags around a bit.

 
Comment by Phil Ringnalda #
2003-02-14 23:22:45

Yes, exactly the same hack to rebuild archives when pinged for 2.6 - even the line numbers are unchanged.

 
Trackback by A. L. #
2003-02-26 14:41:12

Le quart d’heure techique

Ou plutôt les quinze secondes. Suivant la tendance faiblarde du moment, qui consiste ŕ instaurer un réseau de trackbacks dans…

 
Trackback by NSLog(); #
2003-02-26 21:20:33

Rebuilding When Pinged

I’d like my archives (individual, daily, monthly, category) to be rebuilt every time an article gets a TrackBack. I did a search and found this article by Phil Ringnalda, but this sentence is preventing me from doing his hack: If you have a fair amount…

 
Trackback by mamamusings #
2003-03-03 09:14:49

do not adjust your browser

I’m experimenting with some changes to my trackback functionality. If you’re trying to ping an entry, and get an error,

 
Comment by Anonymous #
2003-03-03 09:43:44

Worked like a charm! Woohoo!!

Damn. Just realized I didn’t ask permission to use the code, which obviously is copyrighted. My mistake. ;-)

Muchas gracias. Merci beaucoup. etc, etc.

Comment by Liz Lawley #
2003-03-03 09:44:56

Ooops. Following a link and then hitting ”back” apparently wipes out the contact info. Didn’t mean to post anonymously…

Comment by Phil Ringnalda #
2003-03-03 10:47:43

Since that’s how most of my anonymous comments come about (my own and other people’s), it would probably be worthwhile sticking a ”Did you really mean to post anonymously?” page into the process. Most people who really mean it will come up with a Dear Abby-style name anyway, so it shouldn’t catch many of them, just us when we don’t notice that we aren’t remembered. Hmmm. I don’t think the comment error template gets used for anything else if you allow anonymous comments, so it might not even be too involved a hack - if everything’s blank, return the error template with ”Anonymous” filled in for the name.

 
 
Comment by Phil Ringnalda #
2003-03-03 13:01:57

You’re welcome!

I have considered the licensing issue, but it just hasn’t seemed like it would be that much fun to write the Trivial Software Hack License myself, and none of the existing Free licenses actually say what I want - use it however you want, modify it as you please, no warranty, redistribute modifications as you like but distribute the original by link rather than by copying, to cut down on confusing versioning problems. Free redistribution of chunks of code big enough to deserve version numbers isn’t much of a problem, since people have a way of finding out whether they are getting a current copy, but if a dozen people post the actual hack rather than a link, and then I realize there’s a typo or it would be ten times faster with a tiny change, someone searching for it has to figure out that they should look for the canonical version rather than using any random copy. And since everyone that I know of who has ever used any of my hacks has behaved exactly as I would want them to behave, without any prompting from me, I’ve resisted writing a formal license. (Plus, <whispered>strictly speaking, by redistributing modified chunks of MT’s code, I’m actually violating its license, so any license I put on it would probably be invalid anyway</whispered>.)

Comment by Liz Lawley #
2003-03-03 15:44:01

And since everyone that I know of who has ever used any of my hacks has behaved exactly as I would want them to behave, without any prompting from me, I’ve resisted writing a formal license.

Ah…but would you be likely to know about the ones who didn’t behave that way? :-)

At any rate, it was oh-so-nice to find something that did exactly what I needed, worked as advertised, and didn’t break anything in the process. Not a common occurrence for me when it comes to computers (or children, for that matter).

 
 
 
Trackback by voisen.org #
2003-03-18 22:43:10

Hacking Trackbacks: Auto-rebuild On Ping

When I built this site, I didn’t want any popup windows. I didn’t want comments or trackbacks displayed in separate pages. I wanted it all on one page in one easy to locate format. So that’s how I did it….

 
Trackback by Már Örlygsson #
2003-03-27 20:08:27

TrackBack fjör

Í fyrradag kveikti ég á Trackback á síđunum mínum en kvartađi yfir ţví ađ ţćr uppfćrđust ekki sjálfkrafa ţegar Trackback beiđni berst. Matti Á. benti mér strax á leiđbeiningar frá Phil Ringnalda um hvernig megi breyta einni MT forritsskrá til…

 
2003-03-31 21:25:25

trackback gratitude

Thanks to Sean for sharing Phil’s trackback fix!

 
Trackback by mamamusings #
2003-04-05 08:31:31

beginner’s guide to movable type?

The Invisible Adjunct has asked for a beginner’s guide to Movable Type. I’m tempted to take this on…either by myself,

 
Trackback by kasia in a nutshell #
2003-04-24 07:15:43

Ping me, baby

I’ve changed my individual archive template to simplify the layout a bit and in the process changed it to directly…

 
Trackback by A. L. #
2003-04-24 09:53:30

Retour des trackbacks

Qui avaient disparu. J’aime toujours autant le principe, et d’ailleurs, j’encourage tout le monde ŕ s’y mettre, comme le RSS (avec le post en entier, cela va de soi). A propos de trackbacks, je rappelle que les archives de MT…

 
Trackback by NEVERSMILE #
2003-07-09 09:40:13

neversmile vs. trackbacks

After long, long hassles with MT I finally decided to hack the code up a bit. Phil Ringnaralda has done an ingenious bit of thinking and improved MT a hell lot. I followed his instructions here, and voilá! Now all…

 
Trackback by CowPi #
2003-07-19 00:43:01

Trackbacks & Comments

To quote Adam Kalsey, ”TrackBacks are comments. They are comments left on someone else’s site rather than your own, but they are comments nonetheless.” So, he wrote a great little plugin for Movable Type called SimpleComments. After a few modifications…

 
Trackback by CowPi #
2003-07-20 21:09:54

Manual Trackback

’Manual Trackback’ is a PHP script that allows an author of a weblog that does not support trackback to manually trackback to my weblog. All this weblog author needs to supply is the title of his or her weblog, the title or date of his or her weblog en…

 
Trackback by bloomfield.me.uk #
2003-08-09 09:45:08

Auto-rebuild after trackback ping

Just implemented the facility to automatically rebuild individual archives when pinged, which should save the need for me to do it manually….

 
Comment by THomas #
2003-08-13 23:33:21

Thanks for the ’Manual Trackback’ script idea

 
Comment by bomber0 #
2003-08-15 04:35:46

It worked !! Thanks ~

 
Trackback by mamamusings #
2003-08-22 15:01:04

mt courseware documentation and templates

Okay, I think I’ve “gone about as fur as ah c’n go” for this first version of the courseware. I’m ready to call it version 1.0, I guess, with all the caveats that go along with that. You can see it in action on my fall cou…

 
Comment by Andrea #
2003-08-30 02:31:36

thanks for the cool script

 
Trackback by This Chick #
2003-09-23 06:21:57

I love MT even more!

I’ve been playing again. Obviously the layout has changed again. Lets see how long this three column thing lasts! I know it looks OK in the versions of Mozilla, IE6 and Opera that I have. Don’t know about Netscape. Don’t…

 
Trackback by Felocity.org #
2003-09-28 17:57:32

Shiny!

In case the long silence wasn’t a clue, and just in case the new burgundy color wasn’t a tip, felocity.org has been given a new shiny layout! There is a small list of things I have left to do, including

 
Trackback by swirlspice #
2003-10-13 23:14:21

Don’t Mind Me

Just mucking with the comments and trackbacks. UP

 
Trackback by redsugar muse #
2003-10-14 07:17:34

more mt manipulation

i just installed phil ringnalda’s mt hack to make individual archives automatically rebuild when pinged. it’s currently set to rebuild the date-based and category pages…

 
Trackback by PromoGuy dot Net #
2003-10-16 09:36:53

Blacklisted and Tweaked

MT-Blacklist appears to supercede any mods you’ve made to comment notifications. Here are a few links to work-arounds, plus a few other Comment Notifcation Mods you may want to try, and some nifty hacks I found along the way.

 
Comment by Michael Croft #
2003-11-15 11:13:41

Excellent hack. Since I’m also avoiding duplicate trackback pings, the notification failure is not such a big deal, because the dup doesn’t show up.

I wish we could spawn off asyncronous rebuilds or a callback function for pings so we didn’t have to wait. I may look at that, but Perl isn’t my first language…

 
Trackback by Ones and Zeros #
2003-11-15 11:16:04

Plug-ins, hacks, and production code

I just finished a flurry of behind-the-scenes MT hacks and changes. The fruits of these efforts will become more apparent later, but MT should be faster, stronger, better than before…

 
Trackback by spravodaj #
2004-01-05 11:54:46

Trackback vylepšenie pre MT (update)

MT má pre Trackback samostatné okienko, kde pingy vypisuje skript. Akonáhle však výpis pingov na váš príspevok zahrniete do šablóny príspevku, neobjavia sa tam, kým príspevok znovu nerebuildujete. Preto si chcem preštudova? nasledovné príspevky: In MT,…

 
Trackback by spravodaj #
2004-01-05 12:02:41

Ešte jeden návrat k Poohu a Marigoldu

Takže Marigoldov Autotrackback a Poohý ”Trackback” sa volí Referrals. Nájdete to napríklad aj v príspevku na phil ringnalda dot com a úplne naspodu Súvislosti: spravodaj o trackbacku…

 
Trackback by Population: One #
2004-01-09 10:33:27

Rebuilding times

As per Phil Ringnalda’s advice — I’m experimenting with rebuilding individual archives when an entry gets a TrackBack ping. If…

 
Trackback by Procrastination #
2004-01-26 04:59:39

Further Weblog Maintenance

When I changed the way trackbacks appear, I broke something as well. It turns out that when someone pings you, only the index templates are rebuilt automatically. Since I had the trackbacks in the individual entry pages, those were not…

 
Comment by Martin Roell #
2004-02-04 01:40:52

The hack first did not work for me. Then I figured out that the problem was the mt-blacklist plugin: When it was running, checking a trackback against the list and rebuilding the entry took too much time and the script was terminated by the webserver resulting in the pinged entry not being rebuilded. Deactivating mt-blacklist solved the problem.

Comment by Timothy Quinn #
2004-02-17 03:25:37

Thanx Martin, I had the same problem. But how can you make it work with the mt-blacklist plugin?

 
 
Trackback by chris.gushue.net #
2004-03-30 23:57:19

Testing

Just adding a new entry for testing purposes… since I’ll probably just delete it when done. Edit: Ok, I’m mostly happy with how I have trackbacks being displayed in individual archive pages, I just need to get it automatically rebuilding it when it g…

 
2004-04-25 14:04:23

Movable Type MT-Blacklist Hack: Rebuild after Ping

I recently modified my blog to put the trackback information on the entry page, thus eliminating the separate pop-up. On…

 
Trackback by Sillybean #
2004-05-14 09:03:41

Blog stuff

Reading the 300-odd comments on Mena’s MT 3.0 post has led me to a lot of new blogs. Among other things, I learned how to include TrackBacks inline with the comments on individual post archives. Step 1: Grab and install…

 
Comment by Joshua Kaufman #
2004-06-18 17:45:38

Is this needed in MT 3.0D? Same files?

Comment by Phil Ringnalda #
2004-06-18 18:37:29

Hey Joshua! Long time no new version ;)

Nope, this one made the core this time: as long as your server supports Perl’s fork() (which it will, unless it’s IIS), when you get a ping it starts a background process to rebuild everything, including the archives, and to send the email notification, so it can return to the pinger nearly instantly. No need for the hack, and the result should be even better.

 
 
Comment by Doccus #
2004-07-04 17:27:32

Bwahahaha!

Thanks MUCH for posting this hack! I had hacked it myself, but lacked the builddependencies entry … so it didn’t work. I’m hoping it works now :)

D

 
Trackback by mamamusings #
2004-08-01 16:30:32

mt courseware, step-by-step

Templates for my MT-based courseware, and step-by-step instructions on how to implement it. Not for the technically fainthearted; basic MT template and plug-in installation knowledge is assumed.

 
Trackback by Wingie's Cradle #
2005-06-16 01:56:35

The power, of blog

Finally I got DrLiew to play Trackback with me. Reading from various side that MT do not rebuild the entries when a ping is received, and I accidently bumped on this link. Now that I have discovered that w.bloggar does…

 

Sorry, the comment form is closed at this time.