diff --git a/Dockerfile b/Dockerfile index 513a6ffe4c54d..5d4147c233368 100644 --- a/Dockerfile +++ b/Dockerfile @@ -182,7 +182,7 @@ ENV PATH="/opt/perl/local/bin:${PATH}" RUN \ mkdir -p var/run/apache2/ && \ chown www-data:www-data var/run/apache2/ && \ - for path in users products product_images orgs new_images logs; do \ + for path in data html_data users products product_images orgs new_images logs tmp; do \ mkdir -p /mnt/podata/${path}; \ done && \ chown www-data:www-data -R /mnt/podata && \ diff --git a/lib/ProductOpener/Lang.pm b/lib/ProductOpener/Lang.pm index 593b5c1661658..c2863f6faf634 100644 --- a/lib/ProductOpener/Lang.pm +++ b/lib/ProductOpener/Lang.pm @@ -388,11 +388,11 @@ PO # Load stored %Lang from Lang.sto -my $path = "$data_root/Lang.${server_domain}.sto"; +my $path = "$data_root/data/Lang.${server_domain}.sto"; if (-e $path) { $log->info("Loading \%Lang", { path => $path }) if $log->is_info(); - my $lang_ref = retrieve("$data_root/Lang.${server_domain}.sto"); + my $lang_ref = retrieve($path); %Lang = %{$lang_ref}; $log->info("Loaded \%Lang", { path => $path }) if $log->is_info(); @@ -409,7 +409,7 @@ if (-e $path) { sleep(1) if $log->is_info(); } else { - $log->warn("File does not exist, \%Lang will be empty. Run scripts/build_lang.pm to fix this.", { path => $path }) if $log->is_warn(); + $log->warn("Language translation file does not exist, \%Lang will be empty. Run scripts/build_lang.pm to fix this.", { path => $path }) if $log->is_warn(); } diff --git a/scripts/build_lang.pl b/scripts/build_lang.pl index 511541f4e79fd..2c3e1aceb25b6 100755 --- a/scripts/build_lang.pl +++ b/scripts/build_lang.pl @@ -44,7 +44,10 @@ # use $server_domain in part of the name so that we have different files # when 2 instances of Product Opener share the same $data_root # as is the case with world.openfoodfacts.org and world.preprod.openfoodfacts.org -store("$data_root/Lang.${server_domain}.sto",\%Lang); +if (! -e "$data_root/data") { + mkdir("$data_root/data", 0755) or die("Could not create target directory $data_root/data : $!\n"); +} +store("$data_root/data/Lang.${server_domain}.sto",\%Lang); # Generate JSON files for JavaScript I18N ProductOpener::Lang::build_json();