Posts for the month of November 2006

The new blog is ready!

So I have now competed moving all my stuff from the bblog engine to trac.

To inaugurate the new blog, my notes on how I did it:

  1. By hand, slowly copied and tagged every entry. Made sure the page name was the proper date (ignored timestamp) from the old system.
  2. Wrote a script to fool trac into thinking the pages were actually written on that date (see below).
  3. In the directory with trac.db database:
    1. apachectl stop
    2. sqlite3 trac.db '.dump wiki' > wiki_in.txt
    3. ./trac_blog_datefix.pl < wiki_in.txt > wiki_out.txt
    4. sqlite3 trac.db 'drop table wiki'
    5. sqlite3 trac.db < wiki_out.txt
    6. apachectl start

The script:

#!/usr/bin/perl -w
use Date::Parse;
while (<>) {
        if ($_ !~ /insert into/i) {
                print;
                next;
        }
        if (m|(\d{4}/\d{1,2}/\d{1,2})/|ios) {
                print STDERR "Found date of $1: ";
                my $time1 = str2time($1);
                print STDERR $time1, "\n";
                # Now replace the current timestamp with a newone.
                my $str = $_;
                $str =~ s/\d{10}\.?\d{0,2}/$time1/;
                print $str;
        } else {
                # Standard wiki page (non-blog)
                print;
        }
}