[MTOS-dev] Command-line rebuilds for MT 4.1?
Kaan Kivilcim
kaan at alluremedia.com.au
Tue May 6 16:49:58 PDT 2008
Hey Dan,
Have you tried using the background publishing using run-periodic-tasks?
Not sure if that solves your problem but you might want to look into it.
Kaan Kivilcim
Technical Lead, Allure Media
203/177-185 William St, Darlinghurst NSW 2010
Phone 02 9947 2920 Fax 02 9947 2921 Email kaan at alluremedia.com.au
www.defamer.com.au <http://www.defamer.com.au/> | www.gizmodo.com.au
<http://www.gizmodo.com.au/> | www.kotaku.com.au
<http://www.kotaku.com.au/> | www.lifehacker.com.au
<http://www.lifehacker.com.au/>
From: mtos-dev-bounces at sixapart.com
[mailto:mtos-dev-bounces at sixapart.com] On Behalf Of Dan Sanderson
Sent: Wednesday, 7 May 2008 9:42 AM
To: mtos-dev at sixapart.com
Subject: [MTOS-dev] Command-line rebuilds for MT 4.1?
Hi all -
I'm trying to put together a command-line rebuild tool that works with
MT 4.1. I've seen Tim's mt-rebuild and other build-related extensions,
but so far I haven't gotten the bootstrap code correct yet. I'm now
using Mark's MT::Tool (from SVN head), but so far it hasn't changed the
equation.
If someone already has a command-line rebuilder that works with MT 4.1,
I'd like to see it, but I'd still be interested in sussing this out for
future reference.
What I have so far, based on mt-rebuild and MT::Tool:
#!/usr/bin/perl -w
use strict;
my ($MT_DIR);
BEGIN {
# TODO: hard-coded MT_DIR for now
$MT_DIR = "../../dansanderson.com/blog/mt/";
unshift @INC, $MT_DIR . 'lib';
unshift @INC, $MT_DIR . 'extlib';
}
use lib qw( extlib lib );
use base qw( MT::Tool );
use MT;
# TODO: borrowing this from MT::Tool so I can pass a Config param.
sub set_up_app {
require MT;
my $mt = MT->new( Config => $MT_DIR . 'mt-config.cgi',
Directory => $MT_DIR ) or die MT->errstr;
$mt->{vtbl} = { };
$mt->{is_admin} = 0;
$mt->{template_dir} = 'cms';
$mt->{user_class} = 'MT::Author';
$mt->{plugin_template_path} = 'tmpl';
$mt->run_callbacks('init_app', $mt);
return $mt;
}
sub main {
my $class = shift;
my ($verbose) = $class->SUPER::main(@_);
my $mt = MT->new( Config => $MT_DIR . 'mt-config.cgi',
Directory => $MT_DIR )
|| die MT->errstr;
require MT::Blog;
my $iter = MT::Blog->load_iter;
while ( my $blog = $iter->() ) {
print "Rebuilding blog " . $blog->id . "...\n";
$mt->rebuild( BlogID => $blog->id )
or die "Rebuild error: " . $mt->publish_error();
}
}
__PACKAGE__->main() unless caller;
1;
With my current blog, which is a reasonably fresh install of MT 4.1 (and
10 years of legacy data, woohoo):
* Warning: "Odd number of elements in anonymous hash at
[...]/MT/Blog.pm..." referring to set_defaults(),
$blog->set_values_internal({...}). This is caused by
MT->config('DefaultLanguage') not returning a value, which messes up the
whole hash. (I've been away from Perl enough to have been surprised by
this. :) ) Adding "DefaultLanguage en_US" to my config file fixes this,
but obviously this should not be necessary.
* Warning: "Use of uninitialized value in hash element at
[...]/MT/Serialize.pm line 20", referring to new(), $_[0] being
undefined.
* Warning: "Use of uninitialized value in subroutine entry at
[...]/MT/Serialize.pm line 40", referring to unserialize(),
$ser->{thaw}->(@_).
* Error: "Can't call method "new" on an undefined value at [...]/MT.pm
lin 442", referring to log(), $log_class->new(), where $log_class =
$mt->model('log').
My apologies that I haven't given this the full debugger treatment yet
to get real stack traces, I'll do that if necessary (as time allows).
Any hints come to mind from the above? Anything obvious missing from my
script?
And FWIW, yes rebuilding from the web interface works fine, except for
the inability to rebuild 4000 pages without tripping on server errors
every few hundred pages. (I haven't gotten MT-Hacks' SmartRebuild
working yet either, but one thing at a time.)
Thanks!
-- Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.sixapart.com/pipermail/mtos-dev/attachments/20080507/b4a68cb9/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1107 bytes
Desc: image001.gif
Url : http://www.sixapart.com/pipermail/mtos-dev/attachments/20080507/b4a68cb9/attachment-0001.gif
More information about the MTOS-dev
mailing list