X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fdbupgrade2_tool.pl;h=04c024e1779036bfd93944417341a2b25d1532dd;hb=a6ce2c7f3f7ae10f7065fb86121c8d11049617ee;hp=5ed9c27c111e215c01e7984e25895f67157c4fde;hpb=00ad7b5631ca2557bd02a592b4598699e47edbbd;p=kivitendo-erp.git diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 5ed9c27c1..04c024e17 100755 --- a/scripts/dbupgrade2_tool.pl +++ b/scripts/dbupgrade2_tool.pl @@ -1,16 +1,13 @@ #!/usr/bin/perl BEGIN { - if (! -d "bin" || ! -d "SL") { - print("This tool must be run from the kivitendo ERP base directory.\n"); - exit(1); - } + use FindBin; - unshift @INC, "modules/override"; # Use our own versions of various modules (e.g. YAML). - push @INC, "modules/fallback"; # Only use our own versions of modules if there's no system version. + unshift(@INC, $FindBin::Bin . '/../modules/override'); # Use our own versions of various modules (e.g. YAML). + push (@INC, $FindBin::Bin . '/..'); + push (@INC, $FindBin::Bin . '/../modules/fallback'); # Only use our own versions of modules if there's no system version. } - use strict; use warnings; @@ -299,6 +296,23 @@ sub create_upgrade { print $fh "$comment \@description: $description\n"; print $fh "$comment \@depends: @depends\n"; print $fh "$comment \@encoding: $encoding\n"; + + if ($type eq 'pl') { + print $fh "package SL::DBUpgrade2::$filename;\n"; + print $fh "\n"; + print $fh "use strict;\n"; + print $fh "use utf8;\n" if $encoding =~ /utf.?8/i; + print $fh "\n"; + print $fh "use parent qw(SL::DBUpgrade2::Base);\n"; + print $fh "\n"; + print $fh "sub run {\n"; + print $fh " my (\$self) = \@_;\n"; + print $fh "\n"; + print $fh "}\n"; + print $fh "\n"; + print $fh "1;\n"; + } + close $fh; print "File $full_filename created.\n";