Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision dbcd72ed

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID dbcd72edf94df04115f1844768a92a194289c5f3
  • Vorgänger d0fb3d4d
  • Nachfolger 38a2e789

Kosmetik & Codevereinfachung

Unterschiede anzeigen:

SL/DBUpgrade2.pm
30 30
}
31 31

  
32 32
sub parse_dbupdate_controls {
33
  $main::lxdebug->enter_sub();
33
  $::lxdebug->enter_sub();
34 34

  
35 35
  my ($self) = @_;
36 36

  
37 37
  my $form   = $self->{form};
38
  my $locale = $main::locale;
38
  my $locale = $::locale;
39 39

  
40 40
  local *IN;
41 41
  my %all_controls;
......
115 115

  
116 116
  $self->{all_controls} = \%all_controls;
117 117

  
118
  $main::lxdebug->leave_sub();
118
  $::lxdebug->leave_sub();
119 119

  
120 120
  return \%all_controls;
121 121
}
122 122

  
123 123
sub process_query {
124
  $main::lxdebug->enter_sub();
124
  $::lxdebug->enter_sub();
125 125

  
126 126
  my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
127 127

  
......
208 208

  
209 209
  $fh->close();
210 210

  
211
  $main::lxdebug->leave_sub();
211
  $::lxdebug->leave_sub();
212 212
}
213 213

  
214 214
# Process a Perl script which updates the database.
......
217 217
# users/nologin and end current request".
218 218
# All other return codes are fatal errors.
219 219
sub process_perl_script {
220
  $main::lxdebug->enter_sub();
220
  $::lxdebug->enter_sub();
221 221

  
222 222
  my ($self, $dbh, $filename, $version_or_control, $db_charset) = @_;
223 223

  
......
277 277
  }
278 278
  $dbh->commit();
279 279

  
280
  $main::lxdebug->leave_sub();
280
  $::lxdebug->leave_sub();
281 281
}
282 282

  
283 283
sub process_file {
......
299 299

  
300 300
  if ($ctrl->{"loop"} == 1) {
301 301
    # Not done yet.
302
    _control_error($form, $file_name, $main::locale->text("Dependency loop detected:") . " " . join(" -> ", @path))
302
    _control_error($form, $file_name, $::locale->text("Dependency loop detected:") . " " . join(" -> ", @path))
303 303

  
304 304
  } elsif ($ctrl->{"loop"} == 0) {
305 305
    # Not checked yet.
......
312 312
sub _control_error {
313 313
  my ($form, $file_name, $message) = @_;
314 314

  
315
  $form = $main::form;
316
  my $locale = $main::locale;
315
  $form = $::form;
316
  my $locale = $::locale;
317 317

  
318 318
  $form->error(sprintf($locale->text("Error in database control file '%s': %s"), $file_name, $message));
319 319
}
320 320

  
321 321
sub _dbupdate2_calculate_depth {
322
  $main::lxdebug->enter_sub(2);
322
  $::lxdebug->enter_sub(2);
323 323

  
324 324
  my ($tree, $tag) = @_;
325 325

  
326 326
  my $node = $tree->{$tag};
327 327

  
328
  return $main::lxdebug->leave_sub(2) if (defined($node->{"depth"}));
328
  return $::lxdebug->leave_sub(2) if (defined($node->{"depth"}));
329 329

  
330 330
  my $max_depth = 0;
331 331

  
......
337 337

  
338 338
  $node->{"depth"} = $max_depth + 1;
339 339

  
340
  $main::lxdebug->leave_sub(2);
340
  $::lxdebug->leave_sub(2);
341 341
}
342 342

  
343 343
sub sort_dbupdate_controls {
344 344
  my $self = shift;
345 345

  
346
  return sort({   $a->{"depth"}    !=  $b->{"depth"}    ? $a->{"depth"}    <=> $b->{"depth"}
347
                : $a->{"priority"} !=  $b->{"priority"} ? $a->{"priority"} <=> $b->{"priority"}
348
                :                                         $a->{"tag"}      cmp $b->{"tag"}      } values(%{ $self->{all_controls} }));
346
  return sort { ($a->{depth} <=> $b->{depth}) || ($a->{priority} <=> $b->{priority}) || ($a->{tag} cmp $b->{tag}) } values %{ $self->{all_controls} };
349 347
}
350 348

  
351 349
1;

Auch abrufbar als: Unified diff