Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision e476a9df

Von Moritz Bunkus vor fast 8 Jahren hinzugefügt

  • ID e476a9df6d7b8794add9fe384a624817dc21c21b
  • Vorgänger e2ae8801
  • Nachfolger 4eab0ccf

Auth-DB-Spalten-Infos nur lesen, wenn DB-Verbindung vorhanden

»reset« wird während des Request-Shutdowns ausgeführt. Falls aber noch
gar keine Auth-DB existiert (neue Installation z.B.), so wird versucht,
eine Verbindung dahin aufzubauen, was zu einer Fehlermeldung führt —
selbst, wenn man gerade versucht, besagte Auth-DB anzulegen.

Unterschiede anzeigen:

SL/Auth.pm
59 59
  $self->{FULL_RIGHTS}        = { };
60 60
  $self->{RIGHTS}             = { };
61 61
  $self->{unique_counter}     = 0;
62
  $self->{column_information} = SL::Auth::ColumnInformation->new(auth => $self);
63
  $self->{column_information}->_fetch;
62

  
63
  if ($self->is_db_connected) {
64
    # reset is called during request shutdown already. In case of a
65
    # completely new auth DB this would fail and generate an error
66
    # message even if the user is currently trying to create said auth
67
    # DB. Therefore only fetch the column information if a connection
68
    # has been established.
69
    $self->{column_information} = SL::Auth::ColumnInformation->new(auth => $self);
70
    $self->{column_information}->_fetch;
71
  } else {
72
    delete $self->{column_information};
73
  }
74

  
64 75
  $self->{authenticator}->reset;
65 76

  
66 77
  $self->client(undef);
......
247 258
  $self->{dbh} = SL::DBConnect->connect($dsn, $cfg->{user}, $cfg->{password}, { pg_enable_utf8 => 1, AutoCommit => 1 });
248 259

  
249 260
  if (!$may_fail && !$self->{dbh}) {
261
    delete $self->{dbh};
250 262
    $main::form->error($main::locale->text('The connection to the authentication database failed:') . "\n" . $DBI::errstr);
251 263
  }
252 264

  
......
262 274
  }
263 275
}
264 276

  
277
sub is_db_connected {
278
  my ($self) = @_;
279
  return !!$self->{dbh};
280
}
281

  
265 282
sub check_tables {
266 283
  my ($self, $dbh)    = @_;
267 284

  

Auch abrufbar als: Unified diff