#!/usr/bin/perl -w ############################################################################## # # convert-dates - This program trawls through the database # and converts other methods of date format # into UNIXTIME. This means that date sorting # will work. # # You will need to run this to make the dates # field work in the message display board. # # Author - Redvers Davies # # $Id: convert-dates.pl,v 1.1.1.1 2001/01/16 10:37:48 muhri Exp $ # ############################################################################## 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"; ## wtf? use DBI; require 'csclib.pl'; &read_prefs; my $dbh=&open_db_conn; $sth1 = $dbh->prepare("select id,date from messages"); $sth2 = $dbh->prepare("update messages set localdate=? where id=?"); $sth1->execute; while (($id, $datetext) = $sth1->fetchrow_array) { $date = &date_to_localdate($datetext); $sth2->execute($date, $id); }