line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Ukigumo::Agent::Cleaner; |
2
|
14
|
|
|
14
|
|
70
|
use strict; |
|
14
|
|
|
|
|
20
|
|
|
14
|
|
|
|
|
408
|
|
3
|
14
|
|
|
14
|
|
64
|
use warnings; |
|
14
|
|
|
|
|
17
|
|
|
14
|
|
|
|
|
286
|
|
4
|
14
|
|
|
14
|
|
62
|
use utf8; |
|
14
|
|
|
|
|
21
|
|
|
14
|
|
|
|
|
60
|
|
5
|
14
|
|
|
14
|
|
349
|
use parent "Exporter"; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
94
|
|
6
|
14
|
|
|
14
|
|
813
|
use File::Path qw/rmtree/; |
|
14
|
|
|
|
|
27
|
|
|
14
|
|
|
|
|
2943
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/cleanup_old_branch_dir/; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub ONE_DAY { 60 * 60 * 24 } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub cleanup_old_branch_dir { |
13
|
0
|
|
|
0
|
0
|
|
my ($parent_dir, $cleanup_cycle) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
return if $cleanup_cycle <= 0; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
my $now = time; |
18
|
0
|
|
|
|
|
|
for my $branches_dir (glob "$parent_dir/*") { |
19
|
0
|
|
|
|
|
|
my $last_modified = (stat $branches_dir)[9]; |
20
|
0
|
0
|
|
|
|
|
if ($now - $last_modified > $cleanup_cycle * ONE_DAY()) { |
21
|
0
|
|
|
|
|
|
rmtree($branches_dir); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
27
|
|
|
|
|
|
|
|