Movable Type export format template

| 15 Comments

I have been scoping out the requirements for writing a plugin that generates files in the export file format, so I created an index template to see if I could use a template file to generate everything I needed that way. The good news is that it definitely does work, based on my experiments with several sets of blog data that I have. The bad news is that it doesn't work very well in a shared hosting environment because it is very computationally intensive. It takes 19 seconds to generate the output of just 500 entries with this template, and my blog has about 1600 some entries so far.

 
For people who have Movable Type configured in a way that allows its Perl scripts to run in a high performance manner, such as with mod_perl or in a co-located environment, this template may actually be useful as a method of automated backup. That's why I am releasing this under the terms of the BSD license to anyone who wants to use it or modify it.
 
Update: I originally had the template posted on the page, but that royally screwed up Movable Type's export function because it gets confused by having an export formatted set of data nested inside of an export file. So, here is the code in a separate file.

 


 

15 Comments

Mike,

Know what you need to do? Create a site just for all this stuff you have been doing and sell advertising on it. I figure is a 13 year old girl can make millions doing myspace layouts, you oughta be able to make a few bucks off of your hobby too.

Oh, and when you make your first million, don't forget who told you to do it! (o=

Just to let you know, Mike, my comments seem to be publishing much faster now. So whatever changes you made must have done the trick.

I configured Movable Type to only immediately update the page that you comment on and the main index page when you leave a comment. Normally there are another 7-8 pages and files that have to be rebuilt, but all of those get rebuilt as background processes after you post the comment now :)

hey Mike. I am trying to use this template:
http://pixiepurls.com/index_backup.html

I have MT 3.2 installed. I can not export normally because I am on dreamhost shared servers and it gets stuck. I used the perl DB or whatever, not mySQL otherwise I would just dump my SQL DB.

If you could help me figure out why this isn't working for me (I assume I need 3.2 syntax) I will send you some money via paypal, i can't afford much but I would want to send something. I am so frustrated trying to back up my blog. It's a knitting blog, I actually do computer stuff full time durring the day, but I keep a knitting blog for night time hobby.

On the MT forums this was one method reccomended I could use the lastn attribute to just keep exporting out 250 entry chunks until I got all 1000, then just combine the files together manally.

That would be a problem since it killed all of the formatting :)

Before you try the export template, try these instructions for Movable Type 3 from SixApart. Backup everything you have first, and give that a shot as that may be your cleanest path to getting away from BerkeleyDB and into using MySQL or Postgre.

If that doesn't work, then here is a fresh copy of that template for you. I didn't realize that you were on Dreamhost, and if they haven't changed much, that will work in your favor because when I used them they didn't impose many resource quotas on their users. That means chances are you can afford to get away with dumping all of your blog at once with that template. What I would do is save that template as a new Index Template named "Export Template," copy mt-rebuild into your installation of Movable Type, log into your host and run the following command from there:

./mt-rebuild.pl -mode="index" -blog_id=YOUR_BLOG_ID -template="Export Template"

You might be able to build that from the browser, but usually hosts put a time limit on how long a CGI script can run, and this template takes a little while to fully generate its output.

I make no claim that that template works perfectly. It worked for me when I tested it on my current blog and a blog I used to run.

Now, if what I have posted has helped you and you are feeling generous, there IS a PayPal button on the right hand side of the page ;)

Hi Mike,

I'm trying to put this into use for my blog. When I try to export from Movable Type (MT) from my blog which has 4000+ entries, it does put out a finished TXT file. The finished file, however, is only 2 Megs, it only takes 10 seconds to generate, and it only seems to cover 2 years' worth of entries from a blog that started in 2003. I'm not sure why.

I want to try to implement your script above, but I need a little more help. Would you be willing to provide me with some advice? I'll gladly send you a donation if you can help me back up my blog!

In addition to my e-mail address, I am on Twitter: http://twitter.com/home
I'm also on AIM as fanzinger
So you can reach me any number of ways.

Thank you, in advance, for any advice you may have.

Modify the lastn attribute in the Entries tag accordingly for your blog.

My fault. I think I mis-communicated.

What I meant was that the problems I have been having are what happens when I use the "Export" function in MT. I was explaining my problem and, thus, why I'm trying yours as an alternative.

What I don't get is *what to do* with the template you have above. What do I do with it? Where do I save it, what do I name it, how do I activate it and use it?

I tried saving it as a file called "exporttext.php" in my main directory, and then tried accessing that file. That just gave me an error. So I'm sure I'm doing this wrong.

I need a "For Dummies" set of instructions. Sorry.

It sounds like the operation is timing out. A lot of hosts put a time limit on how long a script can run before it's shut down.

To use the template, just copy and past its contents from here into a new index template under Design->Templates. The file name you specify doesn't matter, so long as it doesn't end in something like PHP or CGI which your host will try to run instead of send you.

If your host is timing out, what you'll have to do is add the offset variable into the Entries tag to export chunks at a time. For example the first time it'd look like:

<mt:Entries offset="0" lastn="500"> followed by
<mt:Entries offset="500" lastn="500"> followed by
<mt:Entries offset="1000" lastn="500">

What are you doing this for? Backup or transferring the entries to a new blog?

BEAUTIFUL! That worked!

http://www.thehutch.com/monitorduty/exporttext.txt

I actually was very close. But I had called it exporttext.php, so it wasn't working. (Well...that, and I had only been clicking "save", not "save and publish". Stupid me.)

OK, I think I see the pattern. This will work beautifully. I'm finally giving up on MT and moving to WordPress, but I had to salvage my blog...so I'm very grateful for your template. I'll throw some cash your way after I get home from work and I can get this extracted.

Thanks again!

I'm finally giving up on MT and moving to WordPress

Well, good luck with that. I switched to Movable Type from WordPress because I found that WordPress was very limited. It's also been my experience watching other WordPress users struggle that upgrading a WordPress blog is as painful as it is with Movable Type.

If you run a decent sized site, you should read up on the performance problems that WordPress has and what they've had to do to solve them. It's not pretty; it amounts to a partial repudiation of their argument that dynamic publishing is the best approach.

If I may?

You may want to paste your instructions into the post so that others of my skill level and lower can use this more easily. The step-by-step instruction really helped.

Hey! I just noticed that this post is dated six days into the future! Weird.

Hey! I just noticed that this post is dated six days into the future! Weird.

Come again?

Never mind. It's February, not January. :-)

I've had many problems with MT. I've been testing Wordpress and it just seems much more user-friendly. MT... you practically have to be an MT coder to like it. Well, I would rather spend my time blogging than trying to figure out how to modify MT... or, God forbid, updating MT and keeping up with all of their changes. Seems like every update makes for a maddening week of backing up data and hoping it doesn't wreck everything...and this time, it wrecked everything. No widgets, my customizations to my templates are gone even though I can see them in the code... I just hate it.

I'll stick with MT if someone volunteers to be my MT guy who does all the coding, but I'm through wasting my life on it. I want a plug-and-play blog.

MT... you practically have to be an MT coder to like it.

Well, to like WordPress, you have to have never coded against it.

No widgets, my customizations to my templates are gone even though I can see them in the code... I just hate it.

Are you saying that you lost your widgets and templates when you upgraded? From what version to which version of Movable Type?

Leave a comment

March 2010

Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      

Recent Entries

Google's lossy compiler
Google's closure compiler service gets a little too frisky under ADVANCED_OPTIMIZATIONS. Original code: With advanced optimizations enabled, it was able…
The three purposes of the federal income tax law
Businesses will spend about 3.4 billion man-hours and individuals about 1.7 billion hours figuring out their taxes this year.…
Progress of a different sort
You know we have reached a level of decadence seldom seen in the history of the West when our women…

Subscribe

Advertisements

OpenID accepted here Learn more about OpenID