blib/lib/oEdtk/lib/db_historicize_ALL.pl untested

filter: Statementstmt 0.0% 0 / 33 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 / 44 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 AND tracking 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 historicize_table( $dbh, $cfg->{'EDTK_DBI_TRACKING'}, $suffixe );
28  
29 warn "INFO: backup done for "
30 . $cfg->{'EDTK_DBI_OUTMNGR'} . " and "
31 . $cfg->{'EDTK_DBI_TRACKING'} . "\n";