summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Migrate/Flyspray.pm
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-12-27 17:30:03 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-12-27 17:30:03 +0100
commit0895a8de0cc5d882fa3e319cf10a09191db423bd (patch)
treee36f26672c893be451007a1f1d7f0a922a3ead3f /Bugzilla/Migrate/Flyspray.pm
parent0ac51c1e94e45e51bd182f859e89f502a548d973 (diff)
downloadbugzilla-0895a8de0cc5d882fa3e319cf10a09191db423bd.tar.gz
bugzilla-0895a8de0cc5d882fa3e319cf10a09191db423bd.tar.xz
WIP: misc fixes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla/Migrate/Flyspray.pm')
-rw-r--r--Bugzilla/Migrate/Flyspray.pm20
1 files changed, 17 insertions, 3 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index cfc605832..701a71a94 100644
--- a/Bugzilla/Migrate/Flyspray.pm
+++ b/Bugzilla/Migrate/Flyspray.pm
@@ -386,7 +386,7 @@ sub _read_bugs {
};
if ($self->translate_value('resolution', $history->{resolution_name} // "") eq "DUPLICATE") {
if ($closure_comment =~ m/FS#(\d+)/) {
- $bug->{dup_id} = int($1);
+ $self->{dupes}->{$row->{task_id}} = int($1);
}
}
} elsif ($history->{event_type} == 3) {
@@ -417,18 +417,24 @@ sub _read_bugs {
while (my $attachment = $attachments_sth->fetchrow_hashref()) {
my $path = $attpath.'/'.$attachment->{file_name};
next unless -f $path;
- push @{$bug->{attachments}}, {
+ next unless -s $path;
+ my $attachment_item = {
submitter => $self->_get_username($attachment->{added_by}),
creation_ts => $attachment->{date_added},
description => $attachment->{file_desc} || $attachment->{orig_name},
filename => $attachment->{orig_name},
- mimetype => $attachment->{file_type} || mimetype($path),
+ #mimetype => $attachment->{file_type},
ispatch => $attachment->{file_type} =~ m/^text\/x-diff/ ? 1 : 0,
data_path => $path,
};
+ #$attachment_item->{mimetype} = mimetype($path) if $attachment_item->{mimetype} eq "" or $attachment_item->{mimetype} !~ m/.+\/.+/;
+ $attachment_item->{mimetype} = mimetype($path);
# TODO: set extra_data and type of comment when attachment is part of a comment.
# problem: how to get attachment id? not yet in db
# change _insert_attachments/_insert_comments?
+ push @{$bug->{attachments}}, $attachment_item;
+ #$self->debug($bug);
+ #die if $attachment->{date_added} == 1110715864;
}
push @result, $bug;
@@ -488,6 +494,14 @@ sub translate_bug {
return wantarray ? ($bug, $other_fields) : $bug;
}
+sub after_insert {
+ my ($self) = @_;
+
+ for my $dupe (keys %{$self->{dupes}}) {
+ $self->{dbh}->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)", undef, $self->{dupes}->{$dupe}, $$dupe);
+ }
+}
+
# Timestamps from flyspray are unix timestamps which Date::Parse
# can't parse so the original parse_date() sub will just die