RSS

A quick load and save

Posted January 10, 2006 | 12:16 PM (EST)



stumbleupon :A quick load and save   digg: A quick load and save   reddit: A quick load and save   del.icio.us: A quick load and save

In response to Michael's comments on NaughtyWordChars, here's a script that should do the trick. Obviously, test on non-crucial data, make backups, operate at your own risk, etc.. It loads all you published entries and saves them (letting the post_save plugin do its work).

#!/usr/bin/perl -w

use strict;

use lib ('lib');
use lib ('extlib');

use MT;
use MT::Entry;
my $mt = MT->new('Config' => 'mt-config.cgi',
	'Directory' => '.') || die MT->errstr;
my $iter = MT::Entry->load_iter( {status => 2} );

while (my $e = $iter->())
{
	$e->save;
	print "Saved entry ".$e->id." ".$e->title."\n";
}

This needs to be run from your root mt directory, and assumes you're using mt-config.cgi not mt.cfg

I just fixed a little non-destructive bug which will spit back a bunch of error messages from the command line, so you may want to grab a fresh copy of the plugin.

Comments for this post are now closed