diff --git a/eprints1.pl b/eprints1.pl index d7ff4b185fb43e62f22e0d11775bf4968a3e6d44..626b807db2a14d92ab5c0a931893ba8e52d0b15c 100755 --- a/eprints1.pl +++ b/eprints1.pl @@ -113,8 +113,8 @@ my $op_mode= 'unknown'; # ====================================================================== # BEGIN OT2UT: Othes to Utheses -my $ot2ut_context= 'ot2ut-entw'; # TODO: parametrize -# my $ot2ut_context= 'ot2ut-test'; # TODO: parametrize +# my $ot2ut_context= 'ot2ut-entw'; # TODO: parametrize +my $ot2ut_context= 'ot2ut-test'; # TODO: parametrize my $oma_sleep_time= 10; my %map_ot2ut_roles= @@ -235,7 +235,7 @@ my @first_names= qw( Henk Henning Henry Herbert Hermann Hermine Herwig Hilde Hildegard Horst Hristov Iacopo Igor Ilona Ilse Ines Ingeborg Ingfrid Ingo Ingrid Irene Irmgard Irmtraud Isabella Isabelle Item Jadranka Jan Jan-Heiner - Jens Jiří Joan Joao Johann Johanna Johannes Jörg Jorinde Josef + Jens Jiří Joan Joao Johann Johanna Johannes Joost Jörg Jorinde Josef József Judith Julia Julius Jürg Jürgen Jutta Karel Karen Karin Karl Karl-Heinz Katharina Katharine Kathrin Katja Katrin Kerstin Kim Kirsten Klara Klára Klaus Klaus-Börge Klaus-Dieter Klemens Konrad @@ -320,6 +320,7 @@ my %name_fixup_by_eprint_id= '23255' => { betreuer => 'Frank, Christa' }, '46724' => { betreuer => 'Leitner, Manuela', beurteiler_1 => 'Leitner, Manuela' }, # othes only shows "Manuela", see https://ubdata.univie.ac.at/AC14545271 '47697' => { betreuer => 'Fischer, Peter' }, + '48949' => { beurteiler_1 => 'Rüffler, Friedrich' }, '49466' => { betreuer => 'Frank, Rüdiger' }, '58166' => { betreuer => 'Marko, Doris' }, # othes says: "Marko Doris" which results in a wrong pick; there are also objects that say "Doris Marko" which lead to a correct pick '55849' => { betreuer => 'Kirchmayr-Schliesselberger, Sabine' }, @@ -342,8 +343,11 @@ my %name_fixup_by_eprint_id= '63391' => { mitbetreuer => 'Garcia, Daniel', beurteiler_2 => 'Garcia, Daniel', }, '63404' => { betreuer => 'Rachwald, Arthur R.' }, '63461' => { betreuer => 'Marko, Doris' }, # othes says: "Marko Doris" which results in a wrong pick; there are also objects that say "Doris Marko" which lead to a correct pick + '63699' => { betreuer => 'Wessner, Barbara' }, ); +my $refresh_oldest_policies; + my %doc_embargo_dates; my $base_path= '/var/www/ot2ut'; # TODO(maybe): get this from the config... # END OT2UT: Othes to Utheses @@ -398,6 +402,7 @@ while (defined ($arg= shift (@ARGV))) elsif ($opt eq 'debug_filenames') { $op_mode= 'debug_filenames'; } elsif ($opt eq 'update-policies') { $op_mode= 'update-policies'; } elsif ($opt eq 'policies-stats') { $op_mode= 'policies-stats'; } + elsif ($opt eq 'refresh-policies') { $refresh_oldest_policies= $val || shift (@ARGV); } elsif ($opt eq 'max') { $MAX_SYNC= $val || shift (@ARGV); } elsif ($opt eq 'mab-age') { $MAX_MAB_AGE= $val || shift (@ARGV); } # in seconds elsif ($opt eq 'marc-age'){ $MAX_MARC_AGE= $val || shift (@ARGV); } # in seconds @@ -2849,6 +2854,17 @@ sub ot2ut last unless ($running); last if (defined ($MAX_SYNC) && $cnt_synced >= $MAX_SYNC); + # there are strange things going on at around midnight, so it might be best, to simply sleep it out... + my @ts= localtime(time()); + if ($ts[2] == 23 && $ts[1] >= 50) + { + send_message("it's almost midnight! ot2ut pausing for 20 minutes..."); + activity({ activity => 'pause', note => 'sleep out midnight activities in the environment' }); + + sleep(20*60); + send_message("ot2ut pause ended"); + } + activity({ activity => 'ot2ut', eprint_id => $eprint_id }) if ($last_activity + $activity_period <= time()); my $t_start= time(); @@ -4418,6 +4434,15 @@ sub update_policies $db_ot2ut= IRMA::db::get_any_db($cnf, 'ot2ut_database') unless (defined ($db_ot2ut)); my $col_utp= $db_ot2ut->get_collection('utheses.policies'); + if (defined ($refresh_oldest_policies) && $refresh_oldest_policies > 0 && $refresh_oldest_policies <= 1000) + { + my $c1= $col_utp->find( {}, { '_id' => 1, eprint_id => 1, generated => 1 }); + $c1->sort( { generated => 1 } ); + $c1->limit( $refresh_oldest_policies ); + my @old= $c1->all(); + foreach my $old (@old) { $upd_eprint_ids{$old->{eprint_id}}= 1; } + } + my @col_names= qw( eprintid lastmod_year lastmod_month lastmod_day lastmod_hour lastmod_minute lastmod_second ); # $epr_db->show_query(1); my $search_term= "eprint_status IN ('archive', 'buffer')"; @@ -4947,6 +4972,7 @@ EOX <html> <head> <meta charset="UTF-8" /> +<meta http-equiv="refresh" content="300" /> <title>othes to utheses migration metablock $metablock_nr</title> <style> td { text-align:right; } @@ -4993,6 +5019,7 @@ EOX <html> <head> <meta charset="UTF-8" /> +<meta http-equiv="refresh" content="300" /> <title>othes to utheses migration block $block_nr</title> <style> td { text-align:right; }