Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6ca9244c

Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt

  • ID 6ca9244cdf323b4ad216ce69e7b9516f8423b344
  • Vorgänger d82316f7
  • Nachfolger e7c035b4

Wenn DB existiert aber Basistabellen fehlen anständige Fehlermeldung anzeigen

Unterschiede anzeigen:

SL/User.pm
48 48

  
49 49
use strict;
50 50

  
51
use constant LOGIN_OK                      =>  0;
52
use constant LOGIN_BASIC_TABLES_MISSING    => -1;
53
use constant LOGIN_DBUPDATE_AVAILABLE      => -2;
54
use constant LOGIN_AUTH_DBUPDATE_AVAILABLE => -3;
55
use constant LOGIN_GENERAL_ERROR           => -4;
56

  
51 57
sub new {
52 58
  $main::lxdebug->enter_sub();
53 59

  
......
96 102
sub login {
97 103
  my ($self, $form) = @_;
98 104

  
99
  return -3 if !$self->{login} || !$::auth->client;
105
  return LOGIN_GENERAL_ERROR() if !$self->{login} || !$::auth->client;
100 106

  
101 107
  my %myconfig = $main::auth->read_user(login => $self->{login});
102 108

  
109
  # Auth DB upgrades available?
110
  my $dbupdater_auth = SL::DBUpgrade2->new(form => $form, auth => 1)->parse_dbupdate_controls;
111
  return LOGIN_AUTH_DBUPDATE_AVAILABLE() if $dbupdater_auth->unapplied_upgrade_scripts($::auth->dbconnect);
112

  
103 113
  # check if database is down
104 114
  my $dbh = $form->dbconnect_noauto;
105 115

  
106 116
  # we got a connection, check the version
107 117
  my ($dbversion) = $dbh->selectrow_array(qq|SELECT version FROM defaults|);
118
  if (!$dbversion) {
119
    $dbh->disconnect;
120
    return LOGIN_BASIC_TABLES_MISSING();
121
  }
108 122

  
109 123
  $self->create_schema_info_table($form, $dbh);
110 124

  
111
  # Auth DB upgrades available?
112
  my $dbupdater_auth = SL::DBUpgrade2->new(form => $form, auth => 1)->parse_dbupdate_controls;
113
  return -3 if $dbupdater_auth->unapplied_upgrade_scripts($::auth->dbconnect);
114

  
115
  my $dbupdater = SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls;
116

  
125
  my $dbupdater        = SL::DBUpgrade2->new(form => $form)->parse_dbupdate_controls;
117 126
  my $update_available = $dbupdater->update2_available($dbh);
118 127
  $dbh->disconnect;
119 128

  
120
  return 0 if !$update_available;
129
  return LOGIN_OK() if !$update_available;
121 130

  
122 131
  $form->{$_} = $::auth->client->{$_} for qw(dbname dbhost dbport dbuser dbpasswd);
123 132
  $form->{$_} = $myconfig{$_}         for qw(datestyle);
......
147 156

  
148 157
  print $form->parse_html_template("dbupgrade/footer");
149 158

  
150
  return -2;
159
  return LOGIN_DBUPDATE_AVAILABLE();
151 160
}
152 161

  
153 162
sub dbconnect_vars {

Auch abrufbar als: Unified diff