X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=scripts%2Fdbupgrade2_tool.pl;h=04c024e1779036bfd93944417341a2b25d1532dd;hb=0399bdb1fcfbb8f7fd1a48771e4fa995037eb4b7;hp=9b1e9e0d8349ede8454aa44451f2e0f47acbb1d5;hpb=0d1bb5102f01eb03da55bc87b52ac52cd7ae7534;p=kivitendo-erp.git diff --git a/scripts/dbupgrade2_tool.pl b/scripts/dbupgrade2_tool.pl index 9b1e9e0d8..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"; @@ -461,8 +475,12 @@ sub build_upgrade_order { ####### ####### -$locale = Locale->new; -$form = Form->new; +$locale = Locale->new; +$form = Form->new; +$::request = SL::Request->new( + cgi => CGI->new({}), + layout => SL::Layout::None->new, +); ####### #######