summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Migrate
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2017-12-27 16:50:09 +0100
committerFlorian Pritz <bluewind@xinu.at>2017-12-27 16:50:09 +0100
commit0ac51c1e94e45e51bd182f859e89f502a548d973 (patch)
tree1a19dc4182ef8fb5c3ce6b71703c6b10cd10aa09 /Bugzilla/Migrate
parentd67d9fd215186016ce370cd8fedc0ec891a081d1 (diff)
downloadbugzilla-0ac51c1e94e45e51bd182f859e89f502a548d973.tar.gz
bugzilla-0ac51c1e94e45e51bd182f859e89f502a548d973.tar.xz
WIP: misc fixes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla/Migrate')
-rw-r--r--Bugzilla/Migrate/Flyspray.pm14
1 files changed, 9 insertions, 5 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index 024b99b4b..cfc605832 100644
--- a/Bugzilla/Migrate/Flyspray.pm
+++ b/Bugzilla/Migrate/Flyspray.pm
@@ -20,7 +20,9 @@ use Bugzilla::DB;
use IO::File;
use List::Util qw(first none);
use SQL::Abstract;
+use File::MimeInfo;
+# FIXME: this is currently broken in Bugzilla::Migrate
#use constant REQUIRED_MODULES => [
#{
#package => 'SQL-Abstract',
@@ -179,7 +181,7 @@ sub _read_users {
email => $row->{email_address},
cryptpassword => "*",
};
- push @result, $item;
+ push @result, $item;
$self->{map_user_id_to_email}->{$row->{user_id}} = $item->{email};
$self->{map_email_to_name}->{$row->{email_address}} = $item->{login_name};
}
@@ -286,10 +288,10 @@ sub _read_bugs {
LEFT OUTER JOIN $fsdb.${fsprfx}list_status ls ON ls.status_id = t.item_status
LEFT OUTER JOIN $fsdb.${fsprfx}list_resolution lr ON lr.resolution_id = t.resolution_reason
LEFT OUTER JOIN $fsdb.${fsprfx}list_version lv ON lv.version_id = t.product_version
- WHERE t.task_id IN (21668, 22102, 23845, 23884)
GROUP BY t.task_id, a.task_id
");
$sth->execute();
+ #WHERE t.task_id IN (21668, 22102, 23845, 23884)
my @result;
while (my $row = $sth->fetchrow_hashref()) {
@@ -382,7 +384,7 @@ sub _read_bugs {
removed => "",
added => $history->{resolution_name},
};
- if ($self->translate_value('resolution', $history->{resolution_name}) eq "DUPLICATE") {
+ if ($self->translate_value('resolution', $history->{resolution_name} // "") eq "DUPLICATE") {
if ($closure_comment =~ m/FS#(\d+)/) {
$bug->{dup_id} = int($1);
}
@@ -413,14 +415,16 @@ sub _read_bugs {
$attachments_sth->execute($row->{task_id});
my $attpath = $self->config("attachment_path");
while (my $attachment = $attachments_sth->fetchrow_hashref()) {
+ my $path = $attpath.'/'.$attachment->{file_name};
+ next unless -f $path;
push @{$bug->{attachments}}, {
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 => $attachment->{file_type} || mimetype($path),
ispatch => $attachment->{file_type} =~ m/^text\/x-diff/ ? 1 : 0,
- data => IO::File->new($attpath.'/'.$attachment->{file_name}, 'r'),
+ data_path => $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