5 die("This script cannot be run from the command line.") unless ($main::form);
12 if (!open(IN, "users/members")) {
13 die($dbup_locale->text("Could not open the file users/members."));
16 my %all_template_dirs;
19 $all_template_dirs{$1} = 1 if (/^templates=(.*)/);
25 foreach my $raw (@_) {
27 push(@new_templates, { "source" => "templates/$raw",
28 "destination" => $1 });
33 foreach my $dir (keys(%all_template_dirs)) {
34 foreach my $template (@new_templates) {
35 my $destination = $dir . "/" . $template->{"destination"};
36 if (-f $destination) {
37 if (!rename($destination, $destination . ".bak")) {
38 push(@warnings, sprintf($dbup_locale->text("Could not rename %s to %s. Reason: %s"),
39 $destination, $destination . ".bak", $!));
42 if (!copy($template->{"source"}, $destination)) {
43 push(@warnings, sprintf($dbup_locale->text("Could not copy %s to %s. Reason: %s"),
44 $template->{"source"}, $destination . ".bak", $!));
50 @warnings = map(+{ "message" => $_ }, @warnings);
51 print($form->parse_html_template2("dbupgrade/update_templates_warnings",
52 { "WARNINGS" => \@warnings }));
59 update_templates("German-winston.xml",
61 "German-credit_note.tex",
62 "German-zahlungserinnerung.tex");