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 32 33 34 35 36 37 38 39 40 41 42 43
|
#!/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 <red@madhouse.org.uk>
#
# $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);
}
|