--- loncom/publisher/lonpublisher.pm 2001/04/16 20:02:50 1.24
+++ loncom/publisher/lonpublisher.pm 2001/04/16 20:47:27 1.25
@@ -86,6 +86,14 @@ sub metaread {
return '
Processed file: '.$fn.'';
}
+# ---------------------------- convert 'time' format into a datetime sql format
+sub sqltime {
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
+ localtime(@_[0]);
+ $mon++; $year+=1900;
+ return "$year-$mon-$mday $hour:$min:$sec";
+}
+
# --------------------------------------------------------- Various form fields
sub textfield {
@@ -485,6 +493,18 @@ sub phasetwo {
}
# -------------------------------- Synchronize entry with SQL metadata database
+ my %perlvar;
+ open (CONFIG,"/etc/httpd/conf/access.conf") || die "Can't read access.conf";
+ my $configline;
+ while ($configline=) {
+ if ($configline =~ /PerlSetVar/) {
+ my ($dummy,$varname,$varvalue)=split(/\s+/,$configline);
+ chomp($varvalue);
+ $perlvar{$varname}=$varvalue;
+ }
+ }
+ close(CONFIG);
+
my $dbh;
{
unless (
@@ -496,7 +516,7 @@ sub phasetwo {
my %sqldatafields;
$sqldatafields{'url'}=$distarget;
- $sth=$dbh->prepare("delete from metadata where url like binary \"".
+ my $sth=$dbh->prepare("delete from metadata where url like binary \"".
$sqldatafields{'url'}."\"");
$sth->execute();
map {my $field=$metadatafields{$_}; $field=~s/\"/\'\'/g;
@@ -515,8 +535,8 @@ sub phasetwo {
'"'.delete($sqldatafields{'abstract'}).'"'.','.
'"'.delete($sqldatafields{'mime'}).'"'.','.
'"'.delete($sqldatafields{'language'}).'"'.','.
- '"'.delete($sqldatafields{'creationdate'}).'"'.','.
- '"'.delete($sqldatafields{'lastrevisiondate'}).'"'.','.
+ '"'.sqltime(delete($sqldatafields{'creationdate'})).'"'.','.
+ '"'.sqltime(delete($sqldatafields{'lastrevisiondate'})).'"'.','.
'"'.delete($sqldatafields{'owner'}).'"'.','.
'"'.delete($sqldatafields{'copyright'}).'"'.')');
$sth->execute();