I have been using Blosxom for a number of years for blog presentation. Long ago, it became unsupported, simply for the fact that
managing a large number of text files is not scalable. Hence the reason why blogging software has long embraced the
database solution. I have reached and exceeded the scalability limits of Blosxom and have now embraced the database
solution offered by Serendipity. My biggest reason for choosing that solution was its use of PostgreSQL as the back end
database. I prefer PostgreSQL over MySQL. Ok, there is my bias showing.
Prior to selecting Serendipity, I flirted briefly with Movable Type. They, however, were going the
MySQL route and deprecating the PostgreSQL side of things. As part of my testing of Movable Type, I wrote a Perl script to take my
Blosxom files, package them together, and make in import file into Movable Type.
After having gone through that exercise, and then finally selecting Serendipity, it was nice to know that
Serendipity knows how to import the basic Movable Type import file. The Serendipity import process doesn't appear to know
how to deal with the categories, so I am in the process of updating those manually.
In addition, new entries are set as 'IsDraft', so I needed to run a database query afterwards to actually 'publish' the entries. I suppose
a better process would have been to manually edit the entries, set the categories, and then 'publish'. But with over 500 entries, that
type of process was a bit daunting, so, instead, I published all the migrated entries, and I'll update categories as time passes.
The Perl script for creating the import file:
#!/usr/bin/perl
use strict;
#use File::stat;
use Fcntl ':mode';
my $author = 'rpb';
my $ext = '.txt';
my %categories;
my @dirs;
my $dir = '/var/www/www.oneunified.net/htdocs/blosxom/';
push( @dirs, $dir );
while ( $dir = pop( @dirs) ) {
chdir( $dir );
opendir( DIR, $dir );
# print( "$dir\n" );
foreach my $file ( readdir( DIR) ) {
if ( $file =~ /.txt$/ ) {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime((stat($file))[9]);
$mon+=1;
$year+=1900;
$mon = substr( '0' . $mon, -2 ,2 );
$mday = substr( '0' . $mday, -2, 2 );
$hour = substr( '0' . $hour, -2, 2 );
$min = substr( '0' . $min, -2, 2 );
$sec = substr( '0' . $sec, -2, 2 );
my $date = "$mon/$mday/$year $hour:$min:$sec";
# print( " $file: $date\n");
open( FILE, '<' . $file );
my $title = <FILE>;
chomp( $title );
my $body;
my $extbody;
my $line;
my $cntblanklines = 0;
my $summary = 1;
while ( $line = <FILE> ) {
if ( $summary ) {
if ( length( $line ) < 2 ) {
++$cntblanklines;
if ( 2 == $cntblanklines ) {
$summary = 0;
}
}
else {
chomp( $line );
$body .= $line . " ";
}
}
else {
$extbody .= $line;
}
}
close( FILE );
$dir =~ /\/([^\/]+$)/;
my $category = $1;
$categories{ $category } = 0;
print( "AUTHOR: $author\n" );
print( "TITLE: $title\n" );
print( "DATE: $date\n" );
print( "PRIMARY CATEGORY: $category\n" );
print( "STATUS: publish\n" );
print( "ALLOW COMMENTS: 1\n" );
print( "ALLOW PINGS: 0\n" );
print( "CONVERT BREAKS: 0\n" );
print("-----\n"); # 2007/06/12 insertion by David Graff
print( "BODY:\n" . $body . "\n-----\n" );
print( "EXTENDED BODY:\n" . $extbody . "\n-----\n" );
print( "--------\n" );
}
my $mode = (stat($file))[2];
if ( S_ISDIR( $mode ) ) {
if ( '.' ne $file && '..' ne $file ) {
push( @dirs, $dir . '/' . $file );
}
}
}
closedir( DIR );
# for my $key ( keys %categories ) {
# print( "$key\n" );
# }
}