Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Movable Type's Publish Queue
use MT;
my $mt = MT->new;
require MT::TheSchwartz::FuncMap;
require MT::TheSchwartz::Job;
require MT::FileInfo;
require MT::WeblogPublisher;
my $funcmap = MT::TheSchwartz::FuncMap->load( { funcname => 'MT::Worker::Publish' } );
return unless $funcmap;
my @jobs = MT::TheSchwartz::Job->load( { funcid => $funcmap->funcid, },
{ 'sort' => 'priority',
direction => 'ascend',
},
);
my $pub = MT::WeblogPublisher->new;
for my $job ( @jobs ) {
if ( my $key = $job->uniqkey ) {
if ( my $finfo = MT::FileInfo->load( $key ) ) {
if ( $pub->rebuild_from_fileinfo( $finfo ) ) {
$job->remove or die $job->errstr;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment