@@ -31,7 +31,6 @@ use File::Path;
3131use File::Basename;
3232use File::Copy qw( move) ;
3333use File::Spec;
34- use File::Slurp;
3534use IO::File;
3635use POSIX ();
3736
@@ -536,7 +535,7 @@ sub update_filesystem {
536535
537536 # Remove old assets htaccess file to force recreation with correct values.
538537 if (-e " $assetsdir /.htaccess" ) {
539- if (read_file (" $assetsdir /.htaccess" ) =~ / <FilesMatch \\\. css\$ >/ ) {
538+ if (read_text (" $assetsdir /.htaccess" ) =~ / <FilesMatch \\\. css\$ >/ ) {
540539 unlink (" $assetsdir /.htaccess" );
541540 }
542541 }
@@ -782,31 +781,30 @@ sub _update_old_charts {
782781# to product IDs.
783782sub _update_old_mining_filenames {
784783 my ($miningdir ) = @_ ;
784+ my $dbh = Bugzilla-> dbh;
785785 my @conversion_errors ;
786786
787- require Bugzilla::Product;
788-
789787 # We use a dummy product instance with ID 0, representing all products
790788 my $product_all = {id => 0, name => ' -All-' };
791- bless ($product_all , ' Bugzilla::Product' );
792789
793790 print " Updating old charting data file names..." ;
794- my @products = Bugzilla::Product-> get_all();
791+ my @products = @{ $dbh -> selectall_arrayref(' SELECT id, name FROM products
792+ ORDER BY name' , {Slice => {}}) };
795793 push (@products , $product_all );
796794 foreach my $product (@products ) {
797- if (-e File::Spec-> catfile($miningdir , $product -> id )) {
795+ if (-e File::Spec-> catfile($miningdir , $product -> { id } )) {
798796 push (@conversion_errors ,
799797 { product => $product ,
800- message => ' A file named "' . $product -> id .
798+ message => ' A file named "' . $product -> { id } .
801799 ' " already exists.' });
802800 }
803801 }
804802
805803 if (! @conversion_errors ) {
806804 # Renaming mining files should work now without a hitch.
807805 foreach my $product (@products ) {
808- if (! rename (File::Spec-> catfile($miningdir , $product -> name),
809- File::Spec-> catfile($miningdir , $product -> id ))) {
806+ if (! rename (File::Spec-> catfile($miningdir , $product -> { name } ),
807+ File::Spec-> catfile($miningdir , $product -> { id } ))) {
810808 push (@conversion_errors ,
811809 { product => $product ,
812810 message => $! });
@@ -822,7 +820,7 @@ sub _update_old_mining_filenames {
822820 print " FAILED:\n " ;
823821 foreach my $error (@conversion_errors ) {
824822 printf " Cannot rename charting data file for product %d (%s ): %s \n " ,
825- $error -> {product }-> id , $error -> {product }-> name,
823+ $error -> {product }-> { id } , $error -> {product }-> { name } ,
826824 $error -> {message };
827825 }
828826 print " You need to empty the \" $miningdir \" directory, then run\n " ,
0 commit comments