From 313be00f0c6baf9b0d44ddda1f0147c203d6a391 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Thu, 21 Mar 2024 08:09:05 -0500 Subject: [PATCH] Fix the OPL-update script (or really the download-OPL-metadata-release.pl script) The `download-OPL-metadata-release.pl` is extracting the downloaded metadata release to the wrong directory, and so the rest of the script fails. It fails quietly, and doesn't actually restore any tables. So a die statement was added to cover this case. --- bin/download-OPL-metadata-release.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/download-OPL-metadata-release.pl b/bin/download-OPL-metadata-release.pl index 32af39376a..2c6f3238bf 100755 --- a/bin/download-OPL-metadata-release.pl +++ b/bin/download-OPL-metadata-release.pl @@ -56,10 +56,13 @@ BEGIN my $arch = Archive::Tar->new($releaseFile); die "An error occurred while creating the tar file: $releaseFile" unless $arch; -$arch->setcwd($path); -$arch->extract(); +$arch->setcwd($ce->{webworkDirs}{tmp}); +$arch->extract; die "There was an error extracting the metadata release: $arch->error" if $arch->error; +die "The downloaded archive did not contain the expected files." + unless -e "$ce->{webworkDirs}{tmp}/webwork-open-problem-library"; + # Copy the json files into htdocs. for (glob("$ce->{webworkDirs}{tmp}/webwork-open-problem-library/JSON-SAVED/*.json")) { copy($_, "$ce->{webworkDirs}{htdocs}/DATA/") or die "Copy $_ to $ce->{webworkDirs}{htdocs}/DATA/ failed: $!";