Stop spam-pinging
Before I started using Movable Type, I noticed that MT blogs seemed to ping weblogs.com without actually having any new content quite often. Once I started using it myself, I realized that the problem was that MT pings every time you save a post with status “Publish”, even if you only saved it because you were correcting a typo. Between my slothful posting pace and my unwillingness to proofread my own typing, that wouldn’t work for me: all too often, after making my dedicated readers wait a couple of days for a new post, I’ll just notice a typo in an old post and correct it, which hardly calls for notifying the whole world. Here’s my hack to only ping weblogs.com (and blo.gs, if you’ve added a ping to it as well) when you have actually added a new post, or changed a post from “Draft” to “Publish”.
In your Movable Type directory, you’ll be editing lib/MT/App/CMS.pm, but first you’ll be saving a backup copy, right? Once that’s done, look for the section that reads:
## If the saved status is RELEASE, or if the *previous* status was
## RELEASE, then rebuild entry archives, indexes, and send the
## XML-RPC ping(s). Otherwise the status was and is HOLD, and we
## don't have to do anything.
if ($obj->status == MT::Entry::RELEASE() ||
$q->param('status_old') eq MT::Entry::RELEASE()) {
require MT::Blog;
my $blog = MT::Blog->load($obj->blog_id);
## Wrap this in an eval to simplify error handling.
eval {
$app->rebuild_entry( Entry => $obj, Blog => $blog,
BuildDependencies => 1 ) or die $app->errstr;
$app->ping(Blog => $blog) or die $app->errstr;
};
if ($@) {
return $app->error("Your post was saved, but the rebuild or ping " .
"failed: $@");
}
}
and replace that with:
## If the saved status is RELEASE, or if the *previous* status was
## RELEASE, then rebuild entry archives and indexes.
if ($obj->status == MT::Entry::RELEASE() ||
$q->param('status_old') eq MT::Entry::RELEASE()) {
require MT::Blog;
my $blog = MT::Blog->load($obj->blog_id);
## Wrap this in an eval to simplify error handling.
eval {
$app->rebuild_entry( Entry => $obj, Blog => $blog,
BuildDependencies => 1 ) or die $app->errstr;
};
if ($@) {
return $app->error("Your post was saved, but the rebuild " .
"failed: $@");
}
## If the previous status was not RELEASE, or if it is a new entry, send the
## XML-RPC ping(s).
if ($is_new ||
$q->param('status_old') ne MT::Entry::RELEASE()) {
eval {
$app->ping(Blog => $blog) or die $app->errstr;
};
if ($@) {
return $app->error("Your post was saved, but the ping " .
"failed: $@");
}
}
}
Save and reupload, and test it out: if you save a new entry with the status “Draft”, you shouldn’t see that you’ve pinged. When you change the status to “Publish” and save, you should see a ping. When you then edit again after it has already been published, you shouldn’t see another ping. Finally, when you save a new entry with the status “Publish” without passing through “Draft”, you should see a ping. Note that you can’t just do all those tests in a row, since you only get to ping once every five minutes, so after you first change from “Draft” to “Publish” and ping, wait five minutes before editing the already published post, to be sure you would see the ping, if it was sent.
Not yet updated for 2.2 – things have changed quite a lot in this section of code, and it’s going to take a while to figure out what went where.
Thanks for the warning
Updated for 2.5: no need to hack, now it’s integrated.
What about when Weblogs.com sites you as a ping spammer, but you aren’t? This has happened to me, and it seems as if they have blocked me from using their pinging service. What do I do to get taken off the ping spamming list? Thankyou!