From e29d72415bae72f9c84f6c46e7fc4f375e4522b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Gigandet?= Date: Fri, 15 Nov 2024 12:16:50 +0100 Subject: [PATCH] fixes --- ..._move_obf_opf_opff_products_to_off_dirs.pl | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/scripts/migrations/2024_11_move_obf_opf_opff_products_to_off_dirs.pl b/scripts/migrations/2024_11_move_obf_opf_opff_products_to_off_dirs.pl index 90b859c8b078c..2ec6e4ce36d9e 100755 --- a/scripts/migrations/2024_11_move_obf_opf_opff_products_to_off_dirs.pl +++ b/scripts/migrations/2024_11_move_obf_opf_opff_products_to_off_dirs.pl @@ -67,6 +67,12 @@ my @products_existing_on_off_but_deleted_locally = (); my @products_existing_on_off_and_not_deleted_on_off_or_locally = (); +# We removed the other servers dirs from the base paths, +# but for this script, we need /srv/off/products and /srv/off/html/images/products + +$BASE_DIRS{OFF_PRODUCTS} = "/srv/off/products"; +$BASE_DIRS{OFF_PRODUCTS_IMAGES} = "/srv/off/html/images/products"; + sub move_product_dir_to_off ($dir, $dir2, $dir3, $dir4) { # move .sto files print STDERR "moving $dir/$dir2/$dir3/$dir4\n"; @@ -89,7 +95,8 @@ ($dir, $dir2, $dir3, $dir4) die; } } - if (move("BASE_DIRS{PRODUCTS}/$dir/$dir2/$dir3/$dir4", "/srv/off/products/$dir/$dir2/$dir3/$dir4")) { + # move the directory to /srv/off/products + if (move("BASE_DIRS{PRODUCTS}/$dir/$dir2/$dir3/$dir4", "/srv/off/products/$dir/$dir2/$dir3/")) { print STDERR "moved /$BASE_DIRS{PRODUCTS}/$dir/$dir2/$dir3/$dir4 to /srv/off/products/$dir/$dir2/$dir3/$dir4\n"; } else { @@ -100,7 +107,7 @@ ($dir, $dir2, $dir3, $dir4) # move images if they exist if (-e "$BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4") { - ensure_dir_created_or_die("$BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3"); + ensure_dir_created_or_die("/srv/off/html/images/products/$dir/$dir2/$dir3"); # if there is an existing off directory for this product, move it to deleted-off-products-codes-replaced-by-other-flavors if (-e "/srv/off/html/images/products/$dir/$dir2/$dir3/$dir4") { if ( @@ -122,21 +129,21 @@ ($dir, $dir2, $dir3, $dir4) if ( move( "$BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4", - "$BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4" + "/srv/off/html/images/products/$dir/$dir2/$dir3/" ) ) { print STDERR - "moved $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4 to $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4\n"; + "moved $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4 to /srv/off/html/images/products/$dir/$dir2/$dir3/$dir4\n"; } else { print STDERR - "could not move $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4 to $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4: $!\n"; + "could not move $BASE_DIRS{PRODUCTS_IMAGES}/$dir/$dir2/$dir3/$dir4 to /srv/off/html/images/products/$dir/$dir2/$dir3/$dir4: $!\n"; die; } } die; - return; + return; } sub check_if_we_can_move_product_dir_to_off ($dir, $dir2, $dir3, $dir4) { @@ -178,7 +185,7 @@ ($dir, $dir2, $dir3, $dir4) push @empty_dirs, "$dir/$dir2/$dir3/$dir4"; } } - return; + return; } my @products = ();