#!/usr/bin/perl -w ############################################################################## # # 13to14.pl - This program updates the database to the # 1.4 format from the 1.3.5 format # # Author - Steve Kordik # # ############################################################################## BEGIN { $libpath = $0; $libpath =~ s!/[^/]+$!!; $libpath =~ s!/bin$!/lib/cscmail!; if (! -e $libpath) { die "Can't find required files in $libpath"; }; } use lib "$libpath"; use lib "$libpath/modules/lib/perl5/site_perl/5.005"; use DBI; require 'csclib.pl'; &read_prefs; my $dbh=&open_db_conn; $sql2= "update messages set sentto = ?, sentfrom= ?, friendly = ? where id = ?"; $query2=$dbh->prepare($sql2); $sql = "select sentto, sentfrom, boxid, id from messages"; $query = $dbh->prepare($sql); $query->execute(); while (@row=$query->fetchrow_array()) { if (($row[2] == 2) or ($row[2] == 3)) { $row[0] = MIME::Words::decode_mimewords($row[0]); $friendly = &process_from($row[0]); } else { $row[1] = MIME::Words::decode_mimewords($row[1]); $friendly = &process_from($row[1]); } $query2->execute($row[0], $row[1], $friendly, $row[3]); }