Created
February 1, 2013 00:27
-
-
Save alfasado/4688067 to your computer and use it in GitHub Desktop.
Movable Type's Publish Queue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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