line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Deploy::ActionProcessor::Action::Move; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
134730045
|
use strict; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
108
|
|
4
|
4
|
|
|
4
|
|
17
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
211
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
$File::Copy::Recursive::CPRFComp = 1; |
7
|
4
|
|
|
4
|
|
16
|
use English qw(-no_match_vars); |
|
4
|
|
|
|
|
36
|
|
|
4
|
|
|
|
|
32
|
|
8
|
4
|
|
|
4
|
|
1818
|
use File::Copy::Recursive; |
|
4
|
|
|
|
|
4157
|
|
|
4
|
|
|
|
|
221
|
|
9
|
4
|
|
|
4
|
|
19
|
use File::Glob; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
182
|
|
10
|
4
|
|
|
4
|
|
16
|
use UNIVERSAL::require; |
|
4
|
|
|
|
|
3
|
|
|
4
|
|
|
|
|
45
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub do { |
13
|
0
|
|
|
0
|
0
|
|
my ($params, $logger) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my $msg = []; |
16
|
0
|
|
|
|
|
|
my $status = 1; |
17
|
0
|
|
|
|
|
|
foreach my $from (File::Glob::glob($params->{from})) { |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my $to = $params->{to}; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $from_local = $from; |
22
|
0
|
|
|
|
|
|
my $to_local = $to; |
23
|
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
if ($OSNAME eq 'MSWin32') { |
25
|
0
|
|
|
|
|
|
FusionInventory::Agent::Tools::Win32->require; |
26
|
0
|
|
|
|
|
|
my $localCodepage = FusionInventory::Agent::Tools::Win32::getLocalCodepage(); |
27
|
0
|
0
|
|
|
|
|
if (Encode::is_utf8($from)) { |
28
|
0
|
|
|
|
|
|
$from_local = encode($localCodepage, $from); |
29
|
|
|
|
|
|
|
} |
30
|
0
|
0
|
|
|
|
|
if (Encode::is_utf8($to)) { |
31
|
0
|
|
|
|
|
|
$to_local = encode($localCodepage, $to); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
0
|
|
|
|
|
if (!File::Copy::Recursive::rmove($from_local, $to_local)) { |
36
|
0
|
|
|
|
|
|
my $m = "Failed to move: `".$from."' to '".$to; |
37
|
0
|
|
|
|
|
|
push @$msg, $m; |
38
|
0
|
|
|
|
|
|
push @$msg, $ERRNO; |
39
|
0
|
|
|
|
|
|
$logger->debug($m); |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
$status = 0; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
return { |
45
|
0
|
|
|
|
|
|
status => $status, |
46
|
|
|
|
|
|
|
msg => $msg, |
47
|
|
|
|
|
|
|
}; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |