From 7e32202c776765875cd0af04d27f9f9c417890ad Mon Sep 17 00:00:00 2001 From: Michal Vaner Date: Fri, 29 Aug 2008 15:30:05 +0200 Subject: [PATCH] Eliminate duplicities from import script --- scripts/importil.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/scripts/importil.pl b/scripts/importil.pl index 21da83f..c149567 100755 --- a/scripts/importil.pl +++ b/scripts/importil.pl @@ -62,9 +62,12 @@ sub getUser( $ ) { } sub addComment( $$$$$ ) { - my( $email, $time, $name, $comment, $history ) = @_; + my( $email, $time, $name, $comment, $discussion ) = @_; my $user = getUser( $email ); - $newcomment->execute( $user, $addr->get(), $time, $name, $comment, $history ); + $name = undef if( ( defined $name ) && $name !~ /\S/ ); + $comment = undef if( ( defined $comment ) && $comment !~ /\S/ ); + $discussion = undef if( ( defined $discussion ) && $discussion !~ /\S/ ); + $newcomment->execute( $user, $addr->get(), $time, $name, $comment, $discussion ); my $id = $db->last(); $comment = "" unless defined $comment; $name = "" unless defined $name; @@ -100,10 +103,10 @@ while( defined( $_ = <> ) ) { my $hid = addComment( $email, $time, $name, $comment, $discussion ); } elsif ( $command eq "APPROVE" ) { my( $time, $email, $name, $comment ) = @params; - $comment = "" unless defined $comment; - $name = "" unless defined $name; + $comment = "" if( !defined $comment || $comment !~ /\S/ ); + $name = "" if( !defined $name || $name !~ /\S/ ); my $hid = $ids{"$name\t$comment"}; - $hid = addComment( $email, $time, $name, $comment, undef ); + $hid = addComment( $email, $time, $name, $comment, undef ) unless defined $hid; markAllSeen(); setMain( $hid ); } elsif ( $command eq "COMMENT" ) {# Comments are from admins -> they mark as seen too -- 2.39.5