Fun with drafts
Bug.
Can’t use patches? That’s a shame. Incomprehensible as it can be, there are a lot of things Unix got right, and diff and patch are two huge ones. If I need to tell you how to change two lines in a file to fix something, I can either save a copy before I start editing, make the edits, then say diff -Naur Trackback.pm.orig Trackback.pm > NoDrafts.Trackback.pm.patch and be done with it, and you can then copy the patch to your lib/MT/App directory and type patch -p0 < NoDrafts.Trackback.pm.patch and we’re all done, or…
You can save a copy of {yourMTdir}/lib/MT/App/Trackback.pm for safety’s sake, then open it in a text editor, find the spot around line 13 where it says:
use MT::App;
@MT::App::Trackback::ISA = qw( MT::App );
and in between those two lines insert
use MT::Entry qw( HOLD RELEASE REVIEW );
so you have
use MT::App;
use MT::Entry qw( HOLD RELEASE REVIEW );
@MT::App::Trackback::ISA = qw( MT::App );
Then down around line 37 find
my $entry = MT::Entry->load($entry_id)
or return $app->error($app->translate(
"Invalid entry ID '[_1]'", $entry_id));
my $ctx = MT::Template::Context->new;
and insert
$entry->status == RELEASE
or return $app->error("What are you doing in my underwear drawer?");
so you have
my $entry = MT::Entry->load($entry_id)
or return $app->error($app->translate(
"Invalid entry ID '[_1]'", $entry_id));
$entry->status == RELEASE
or return $app->error("What are you doing in my underwear drawer?");
my $ctx = MT::Template::Context->new;
save it and re-upload it, and people won’t be able to see your draft entry titles by just guessing entry numbers in the Trackback “view” URL.
To give credit where credit is due, diff and patch were written by Larry Wall, the same man who invented Perl.
I actually thought about mentioning that, having oddly enough read it three times in the last week, but then I started thinking about Perl, and how diff has thirty billion options, and defaults to what you really don’t particularly want (though I’m sure there’s an extremely well-thought-out reason that would make perfect sense to me if I had several hours with an experienced Unix philosopher), and I started to smell rant on the breeze, and desisted.
Where do you find the time for all this?
My two main weapons are:
can u plz tell me how did you create that nice Archive? I do have blogger acount…