Revision 4c16179d
Von Sven Schöling vor fast 14 Jahren hinzugefügt
scripts/dbupgrade2_tool.pl | ||
---|---|---|
12 | 12 |
|
13 | 13 |
|
14 | 14 |
use strict; |
15 |
use warnings; |
|
15 | 16 |
|
16 | 17 |
use utf8; |
17 | 18 |
use English '-no_match_vars'; |
... | ... | |
41 | 42 |
my ($opt_user, $opt_apply, $opt_applied, $opt_format, $opt_test_utf8); |
42 | 43 |
my ($opt_dbhost, $opt_dbport, $opt_dbname, $opt_dbuser, $opt_dbpassword); |
43 | 44 |
|
44 |
our (%myconfig, $form, $user, $auth, $locale, $controls); |
|
45 |
our (%myconfig, $form, $user, $auth, $locale, $controls, $dbupgrader);
|
|
45 | 46 |
|
46 | 47 |
sub show_help { |
47 | 48 |
my $help_text = <<"END_HELP" |
... | ... | |
108 | 109 |
} |
109 | 110 |
|
110 | 111 |
sub dump_list { |
111 |
my @sorted_controls = sort_dbupdate_controls($controls);
|
|
112 |
my @sorted_controls = $dbupgrader->sort_dbupdate_controls;
|
|
112 | 113 |
|
113 | 114 |
print "LIST VIEW\n\n" . |
114 | 115 |
"number tag depth priority\n"; |
... | ... | |
137 | 138 |
|
138 | 139 |
calc_rev_depends(); |
139 | 140 |
|
140 |
my @sorted_controls = sort_dbupdate_controls($controls);
|
|
141 |
my @sorted_controls = $dbupgrader->sort_dbupdate_controls;
|
|
141 | 142 |
|
142 | 143 |
foreach my $control (@sorted_controls) { |
143 | 144 |
dump_node($control->{tag}, "") unless (@{ $control->{rev_depends} }); |
... | ... | |
161 | 162 |
|
162 | 163 |
calc_rev_depends(); |
163 | 164 |
|
164 |
my @sorted_controls = sort_dbupdate_controls($controls);
|
|
165 |
my @sorted_controls = $dbupgrader->sort_dbupdate_controls;
|
|
165 | 166 |
|
166 | 167 |
foreach my $control (@sorted_controls) { |
167 | 168 |
last if ($control->{depth} > 1); |
... | ... | |
194 | 195 |
foreach my $c (values %{ $controls }) { |
195 | 196 |
$ranks{$c->{depth}} ||= []; |
196 | 197 |
|
197 |
my ($pre, $post) = ('node [fillcolor=lightgray] ', 'node [fillcolor=white] ') if (!scalar @{ $c->{rev_depends} }); |
|
198 |
my ($pre, $post) = @{ $c->{rev_depends} } ? ('')x2 : |
|
199 |
(map "node [fillcolor=$_] ", qw(lightgray white)); |
|
198 | 200 |
|
199 | 201 |
push @{ $ranks{$c->{"depth"}} }, qq|${pre}"$c->{tag}"; ${post}|; |
200 | 202 |
} |
... | ... | |
204 | 206 |
} |
205 | 207 |
|
206 | 208 |
foreach my $c (values %{ $controls }) { |
207 |
print OUT "$c->{tag};\n";
|
|
209 |
print OUT qq|"$c->{tag}";\n|;
|
|
208 | 210 |
|
209 | 211 |
foreach my $d (@{ $c->{depends} }) { |
210 |
print OUT "$c->{tag} -> $d;\n";
|
|
212 |
print OUT qq|"$c->{tag}" -> "$d";\n|;
|
|
211 | 213 |
} |
212 | 214 |
} |
213 | 215 |
|
... | ... | |
272 | 274 |
print "Applying upgrade $control->{file}\n"; |
273 | 275 |
|
274 | 276 |
if ($file_type eq "sql") { |
275 |
$user->process_query($form, $dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
|
|
277 |
$dbupgrader->process_query($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
|
|
276 | 278 |
} else { |
277 |
$user->process_perl_script($form, $dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
|
|
279 |
$dbupgrader->process_perl_script($dbh, "sql/$form->{dbdriver}-upgrade2/$control->{file}", $control);
|
|
278 | 280 |
} |
279 | 281 |
} |
280 | 282 |
|
... | ... | |
359 | 361 |
eval { require "config/lx-erp.conf"; }; |
360 | 362 |
eval { require "config/lx-erp-local.conf"; } if (-f "config/lx-erp-local.conf"); |
361 | 363 |
|
364 |
$locale = Locale->new($::language); |
|
362 | 365 |
$form = Form->new(); |
363 |
$locale = Locale->new("de"); |
|
364 | 366 |
|
365 | 367 |
####### |
366 | 368 |
####### |
... | ... | |
386 | 388 |
|
387 | 389 |
show_help() if ($opt_help); |
388 | 390 |
|
389 |
$controls = parse_dbupdate_controls($form, "Pg"); |
|
391 |
$dbupgrader = SL::DBUpgrade2->new(form => $form, dbdriver => 'Pg'); |
|
392 |
$controls = $dbupgrader->parse_dbupdate_controls->{all_controls}; |
|
390 | 393 |
|
391 | 394 |
dump_list() if ($opt_list); |
392 | 395 |
dump_tree() if ($opt_tree); |
Auch abrufbar als: Unified diff
dbupgrade_tool.pl auf SL::DBUpgrade2 angepasst.
Conflicts: