+ die "cannot find user $login" unless %::myconfig = $::auth->read_user(login => $login);
+ die "cannot find locale for user $login" unless $::locale = Locale->new($::myconfig{countrycode} || $::lx_office_conf{system}->{language});
+}
+
+sub cleanup_kivitendo {
+ eval { SL::DB::Auth->new->db->dbh->rollback; };
+ eval { SL::DB::BackgroundJob->new->db->dbh->rollback; };
+
+ $::auth->save_session;
+ $::auth->expire_sessions;
+ $::auth->reset;
+
+ $::form = undef;
+ $::myconfig = ();
+ $::request = undef;
+ $::auth = undef;
+}
+
+sub clean_before_sleeping {
+ Form::disconnect_standard_dbh;
+ SL::DBConnect::Cache->disconnect_all_and_clear;
+ SL::DB->db_cache->clear;