Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 626ec4b4

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 626ec4b4e4f6dbb6d018fa71819098c73fb59c53
  • Vorgänger 9b0c7269
  • Nachfolger 486fe464

DB-Upgrade-Mechanismus für auth-Scripte im Verzeichnis sql/Pg-upgrade2-auth implementiert

Unterschiede anzeigen:

bin/mozilla/admin.pl
43 43

  
44 44
use SL::Auth;
45 45
use SL::Form;
46
use SL::Iconv;
46 47
use SL::Mailer;
47 48
use SL::User;
48 49
use SL::Common;
......
84 85
        $::auth->set_session_value('rpw', $::form->{rpw});
85 86
        $::auth->create_or_refresh_session();
86 87
      }
88

  
89
      _apply_dbupgrade_scripts();
90

  
87 91
      call_sub($locale->findsub($form->{action}));
88 92
    }
89 93
  } else {
......
1162 1166
  $form->error($locale->text('No action defined.'));
1163 1167
}
1164 1168

  
1169
sub _apply_dbupgrade_scripts {
1170
  my $dbh               = $::auth->dbconnect;
1171
  my $dbdriver          = 'Pg';
1172
  my $dbupdater         = SL::DBUpgrade2->new(form => $::form, dbdriver => $dbdriver, auth => 1)->parse_dbupdate_controls;
1173
  my @unapplied_scripts = $dbupdater->unapplied_upgrade_scripts($dbh);
1174

  
1175
  return if !@unapplied_scripts;
1176

  
1177
  my $db_charset = $main::dbcharset || Common::DEFAULT_CHARSET;
1178
  $form->{login} = 'admin';
1179

  
1180
  map { $_->{description} = SL::Iconv::convert($_->{charset}, $db_charset, $_->{description}) } values %{ $dbupdater->{all_controls} };
1181

  
1182
  $form->{title} = $::locale->text('Dataset upgrade');
1183
  $form->header;
1184
  print $form->parse_html_template("dbupgrade/header", { dbname => $::auth->{DB_config}->{db} });
1185

  
1186
  foreach my $control (@unapplied_scripts) {
1187
    $::lxdebug->message(LXDebug->DEBUG2(), "Applying Update $control->{file}");
1188
    print $form->parse_html_template("dbupgrade/upgrade_message2", $control);
1189

  
1190
    $dbupdater->process_file($dbh, "sql/${dbdriver}-upgrade2-auth/$control->{file}", $control, $db_charset);
1191
  }
1192

  
1193
  print $form->parse_html_template("dbupgrade/footer", { is_admin => 1, menufile => 'admin.pl' });
1194
  ::end_of_request();
1195
}
1196

  
1165 1197
1;

Auch abrufbar als: Unified diff