From 8b0a6f4332296ba396b3c02401ddd1aa4a97b610 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Fri, 9 Mar 2018 14:53:18 +0100 Subject: Misc fixes Signed-off-by: Florian Pritz --- Bugzilla/Migrate.pm | 8 ++++++++ migrate.pl | 13 ++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm index 925a01355..da2d1a750 100644 --- a/Bugzilla/Migrate.pm +++ b/Bugzilla/Migrate.pm @@ -279,6 +279,7 @@ sub bugs { ########### sub check_requirements { + return; my $self = shift; my $missing = Bugzilla::Install::Requirements::_check_missing( $self->REQUIRED_MODULES, 1); @@ -767,6 +768,9 @@ sub insert_bugs { $dbh->do('UPDATE bugs SET creation_ts = ?, delta_ts = ? WHERE bug_id = ?', undef, $bug->{creation_ts}, $bug->{creation_ts}, $created->id); + $dbh->do('UPDATE longdescs SET bug_when = ? + WHERE bug_id = ?', undef, $bug->{creation_ts}, + $created->id); } if (defined $bug->{delta_ts}) { $dbh->do('UPDATE bugs SET delta_ts = ? WHERE bug_id = ?', @@ -841,6 +845,10 @@ sub _insert_attachments { $self->debug(' Inserting attachments:', 2); foreach my $attachment (@$attachments) { $self->debug($attachment, 3); + my $data_path = delete $attachment->{data_path}; + if (defined $data_path) { + $attachment->{data} = IO::File->new($data_path, 'r'); + } # Make sure that our pointer is at the beginning of the file, # because usually it will be at the end, having just been fully # written to. diff --git a/migrate.pl b/migrate.pl index 8980248c7..1de0baff6 100755 --- a/migrate.pl +++ b/migrate.pl @@ -11,8 +11,15 @@ use strict; use warnings; use File::Basename; -BEGIN { chdir dirname($0); } -use lib qw(. lib local/lib/perl5); +use File::Spec; +BEGIN { + require lib; + my $dir = File::Spec->rel2abs(dirname(__FILE__)); + my $base = File::Spec->catdir($dir); + lib->import($base, File::Spec->catdir($base, "lib"), File::Spec->catdir($base, qw(local lib perl5))); + chdir $base; +} + use Bugzilla; use Bugzilla::Migrate; @@ -96,4 +103,4 @@ the size of all attachments in your current bug-tracker. You may also need to increase the number of file handles a process is allowed to hold open (as the migrator will create a file handle for each attachment in your database). On Linux and simliar systems, you can do this as root -by typing C before running your script. \ No newline at end of file +by typing C before running your script. -- cgit v1.2.3-24-g4f1b