Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0c32dd23

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 0c32dd23e6c2d104239bd489fc61b81db8f19f59
  • Vorgänger 1e0d4130
  • Nachfolger 6b9cf44d

Bei Auth-DB-Verbindung nur Transaktionen starten, wenn tatsächlich Dinge verändert werden; dann explizit locken

Fix für Bug 1565.

Unterschiede anzeigen:

SL/Auth.pm
166 166

  
167 167
  $main::lxdebug->message(LXDebug->DEBUG1, "Auth::dbconnect DSN: $dsn");
168 168

  
169
  $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 0 });
169
  $self->{dbh} = DBI->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => $::locale->is_utf8, AutoCommit => 1 });
170 170

  
171 171
  if (!$may_fail && !$self->{dbh}) {
172 172
    $main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr);
......
306 306

  
307 307
  my ($sth, $query, $user_id);
308 308

  
309
  $dbh->begin_work;
310

  
309 311
  $query     = qq|SELECT id FROM auth."user" WHERE login = ?|;
310 312
  ($user_id) = selectrow_query($form, $dbh, $query, $login);
311 313

  
......
426 428
  my $form  = $main::form;
427 429

  
428 430
  my $dbh   = $self->dbconnect();
431

  
432
  $dbh->begin_work;
433

  
429 434
  my $query = qq|SELECT id FROM auth."user" WHERE login = ?|;
430 435

  
431 436
  my ($id)  = selectrow_query($form, $dbh, $query, $login);
432 437

  
433
  return $main::lxdebug->leave_sub() if (!$id);
438
  $dbh->rollback and return $main::lxdebug->leave_sub() if (!$id);
434 439

  
435 440
  do_query($form, $dbh, qq|DELETE FROM auth.user_group WHERE user_id = ?|, $id);
436 441
  do_query($form, $dbh, qq|DELETE FROM auth.user_config WHERE user_id = ?|, $id);
......
512 517
  if ($session_id) {
513 518
    my $dbh = $self->dbconnect();
514 519

  
520
    $dbh->begin_work;
521

  
515 522
    do_query($main::form, $dbh, qq|DELETE FROM auth.session_content WHERE session_id = ?|, $session_id);
516 523
    do_query($main::form, $dbh, qq|DELETE FROM auth.session WHERE id = ?|, $session_id);
517 524

  
......
530 537
  my $self  = shift;
531 538

  
532 539
  my $dbh   = $self->dbconnect();
540

  
541
  $dbh->begin_work;
542

  
533 543
  my $query =
534 544
    qq|DELETE FROM auth.session_content
535 545
       WHERE session_id IN
......
575 585
  $form  = $main::form;
576 586
  $dbh   = $self->dbconnect();
577 587

  
588
  $dbh->begin_work;
589
  do_query($::form, $dbh, qq|LOCK auth.session_content|);
590

  
578 591
  $query = qq|SELECT id FROM auth.session WHERE id = ?|;
579 592

  
580 593
  ($id)  = selectrow_query($form, $dbh, $query, $session_id);
......
600 613

  
601 614
  my $dbh          = $provided_dbh || $self->dbconnect();
602 615

  
616
  $dbh->begin_work unless $provided_dbh;
617

  
618
  do_query($::form, $dbh, qq|LOCK auth.session_content|);
603 619
  do_query($::form, $dbh, qq|DELETE FROM auth.session_content WHERE session_id = ?|, $session_id);
604 620

  
605 621
  if (%{ $self->{SESSION} }) {
......
821 837
  my $form  = $main::form;
822 838
  my $dbh   = $self->dbconnect();
823 839

  
840
  $dbh->begin_work;
841

  
824 842
  my ($query, $sth, $row, $rights);
825 843

  
826 844
  if (!$group->{id}) {
......
866 884
  my $form = $main::from;
867 885

  
868 886
  my $dbh  = $self->dbconnect();
887
  $dbh->begin_work;
869 888

  
870 889
  do_query($form, $dbh, qq|DELETE FROM auth.user_group WHERE group_id = ?|, $id);
871 890
  do_query($form, $dbh, qq|DELETE FROM auth.group_rights WHERE group_id = ?|, $id);

Auch abrufbar als: Unified diff