]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1273846 - Checksetup fails to update chart storage during pre-3.6 -> 5.0 upgrade
authorFrédéric Buclin <LpSolit@gmail.com>
Thu, 19 May 2016 22:42:54 +0000 (00:42 +0200)
committerFrédéric Buclin <LpSolit@gmail.com>
Thu, 19 May 2016 22:42:54 +0000 (00:42 +0200)
r/a=dkl

Bugzilla/Install/Filesystem.pm

index 4f133d8656eea787c73b8269fa251b71b11f913c..43512e79ce1debe0a43d287e76a01cca85755bb9 100644 (file)
@@ -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",