blib/lib/oEdtk/lib/db_historicize_index.pl untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 43 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/perl
2  
3 use oEdtk::Config qw(config_read);
4 use oEdtk::DBAdmin qw(db_connect historicize_table);
5 use Term::ReadKey;
6 use POSIX qw(strftime);
7 use warnings;
8 use strict;
9  
10 my $cfg = config_read('EDTK_DB');
11 my $dbh = db_connect( $cfg, 'EDTK_DBI_DSN' );
12 my $suffixe = strftime "%Y%m%d%H%M%S", localtime;
13 my $wait_time = 30 * $cfg->{'EDTK_WAITRUN'} || 600;
14  
15 warn "INFO: historicize index table\n";
16 warn "INFO: table should not be in use\n";
17 warn "INFO: waiting $wait_time sec... press 'N' or 'S' to stop or any to run\n";
18  
19 ReadMode('raw');
20 my $key = ReadKey($wait_time);
21 if ( $key =~ /^[ns]$/i ) {
22 die "INFO: abort request\n";
23 }
24 ReadMode('restore');
25  
26 historicize_table( $dbh, $cfg->{'EDTK_DBI_OUTMNGR'}, $suffixe );
27  
28 warn "INFO: backup done for " . $cfg->{'EDTK_DBI_OUTMNGR'} . "\n";