diff options
author | Frédéric Buclin <LpSolit@netscape.net> | 2016-08-05 15:24:24 +0200 |
---|---|---|
committer | Frédéric Buclin <LpSolit@netscape.net> | 2016-08-05 15:24:24 +0200 |
commit | 4dabb5468ca856c84ef9add045785c73f6a2e94c (patch) | |
tree | c8108f611fe4301594c4b813a51d0d7467634431 /Bugzilla | |
parent | b08fccefe77cea448f4b677f474daf2480187915 (diff) | |
parent | c0c58d459ef10ef03e470b8fbaabd14703fd4c27 (diff) | |
download | bugs-4dabb5468ca856c84ef9add045785c73f6a2e94c.tar bugs-4dabb5468ca856c84ef9add045785c73f6a2e94c.tar.gz bugs-4dabb5468ca856c84ef9add045785c73f6a2e94c.tar.bz2 bugs-4dabb5468ca856c84ef9add045785c73f6a2e94c.tar.xz bugs-4dabb5468ca856c84ef9add045785c73f6a2e94c.zip |
Merge branch '5.0' of https://github.com/bugzilla/bugzilla
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Install/Filesystem.pm | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Bugzilla/Install/Filesystem.pm b/Bugzilla/Install/Filesystem.pm index 4f133d865..43512e79c 100644 --- a/Bugzilla/Install/Filesystem.pm +++ b/Bugzilla/Install/Filesystem.pm @@ -782,22 +782,21 @@ sub _update_old_charts { # to product IDs. sub _update_old_mining_filenames { my ($miningdir) = @_; + my $dbh = Bugzilla->dbh; my @conversion_errors; - require Bugzilla::Product; - # We use a dummy product instance with ID 0, representing all products my $product_all = {id => 0, name => '-All-'}; - bless($product_all, 'Bugzilla::Product'); print "Updating old charting data file names..."; - my @products = Bugzilla::Product->get_all(); + my @products = @{ $dbh->selectall_arrayref('SELECT id, name FROM products + ORDER BY name', {Slice=>{}}) }; push(@products, $product_all); foreach my $product (@products) { - if (-e File::Spec->catfile($miningdir, $product->id)) { + if (-e File::Spec->catfile($miningdir, $product->{id})) { push(@conversion_errors, { product => $product, - message => 'A file named "' . $product->id . + message => 'A file named "' . $product->{id} . '" already exists.' }); } } @@ -805,8 +804,8 @@ sub _update_old_mining_filenames { if (! @conversion_errors) { # Renaming mining files should work now without a hitch. foreach my $product (@products) { - if (! rename(File::Spec->catfile($miningdir, $product->name), - File::Spec->catfile($miningdir, $product->id))) { + if (! rename(File::Spec->catfile($miningdir, $product->{name}), + File::Spec->catfile($miningdir, $product->{id}))) { push(@conversion_errors, { product => $product, message => $! }); @@ -822,7 +821,7 @@ sub _update_old_mining_filenames { print " FAILED:\n"; foreach my $error (@conversion_errors) { printf "Cannot rename charting data file for product %d (%s): %s\n", - $error->{product}->id, $error->{product}->name, + $error->{product}->{id}, $error->{product}->{name}, $error->{message}; } print "You need to empty the \"$miningdir\" directory, then run\n", |