| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Daje::Workflow::FileChanged::Activity; |
|
2
|
1
|
|
|
1
|
|
361679
|
use Mojo::Base 'Daje::Workflow::Common::Activity::Base', -base, -signatures; |
|
|
1
|
|
|
|
|
46669
|
|
|
|
1
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
6285
|
use Daje::Config; |
|
|
1
|
|
|
|
|
411874
|
|
|
|
1
|
|
|
|
|
12
|
|
|
5
|
1
|
|
|
1
|
|
8404
|
use Daje::Tools::Filechanged; |
|
|
1
|
|
|
|
|
1176
|
|
|
|
1
|
|
|
|
|
11
|
|
|
6
|
1
|
|
|
1
|
|
880
|
use Daje::Workflow::FileChanged::Database::Model::FileHashes; |
|
|
1
|
|
|
|
|
5
|
|
|
|
1
|
|
|
|
|
10
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# NAME |
|
9
|
|
|
|
|
|
|
# |
|
10
|
|
|
|
|
|
|
# Daje::Workflow::FileChanged::Activity - It's new $module |
|
11
|
|
|
|
|
|
|
# |
|
12
|
|
|
|
|
|
|
# SYNOPSIS |
|
13
|
|
|
|
|
|
|
# ======== |
|
14
|
|
|
|
|
|
|
# use Daje::Workflow::FileChanged::Activity; |
|
15
|
|
|
|
|
|
|
# |
|
16
|
|
|
|
|
|
|
# my $activity = Daje::Workflow::FileChanged::Activity->new( |
|
17
|
|
|
|
|
|
|
# db => $db, |
|
18
|
|
|
|
|
|
|
# context => $context, |
|
19
|
|
|
|
|
|
|
# error => $error, |
|
20
|
|
|
|
|
|
|
# ); |
|
21
|
|
|
|
|
|
|
# |
|
22
|
|
|
|
|
|
|
# $activity->changed_files(); |
|
23
|
|
|
|
|
|
|
# |
|
24
|
|
|
|
|
|
|
# |
|
25
|
|
|
|
|
|
|
# DESCRIPTION |
|
26
|
|
|
|
|
|
|
# =========== |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
# Daje::Workflow::FileChanged::Activity is ... |
|
29
|
|
|
|
|
|
|
# |
|
30
|
|
|
|
|
|
|
# LICENSE |
|
31
|
|
|
|
|
|
|
# |
|
32
|
|
|
|
|
|
|
# Copyright (C) janeskil1525. |
|
33
|
|
|
|
|
|
|
# |
|
34
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or modify |
|
35
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
|
36
|
|
|
|
|
|
|
# |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# LICENSE |
|
39
|
|
|
|
|
|
|
# ======= |
|
40
|
|
|
|
|
|
|
# |
|
41
|
|
|
|
|
|
|
# Copyright (C) janeskil1525. |
|
42
|
|
|
|
|
|
|
# |
|
43
|
|
|
|
|
|
|
# This library is free software; you can redistribute it and/or modify |
|
44
|
|
|
|
|
|
|
# it under the same terms as Perl itself. |
|
45
|
|
|
|
|
|
|
# |
|
46
|
|
|
|
|
|
|
# AUTHOR |
|
47
|
|
|
|
|
|
|
# ====== |
|
48
|
|
|
|
|
|
|
# janeskil1525 Ejaneskil1525@gmail.comE |
|
49
|
|
|
|
|
|
|
# |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
our $VERSION = "0.03"; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
1
|
|
sub changed_files($self) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
my @changed_files; |
|
57
|
|
|
|
|
|
|
my $filelist = Daje::Config->new( |
|
58
|
|
|
|
|
|
|
path => $self->context->{context}->{source_dir} |
|
59
|
0
|
|
|
|
|
|
)->load_list(); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
$self->model->insert_history( |
|
62
|
|
|
|
|
|
|
$filelist->size . " files found", "Daje::Workflow::FileChanged::Activity", 0 |
|
63
|
|
|
|
|
|
|
); |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $filehash = Daje::Workflow::FileChanged::Database::Model::FileHashes->new( |
|
66
|
|
|
|
|
|
|
db => $self->db |
|
67
|
|
|
|
|
|
|
); |
|
68
|
0
|
|
|
|
|
|
my $changed = Daje::Tools::Filechanged->new(); |
|
69
|
0
|
|
|
0
|
|
|
$filelist->each(sub ($file, $num) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $hash_data = $filehash->load_hash($file); |
|
71
|
0
|
0
|
|
|
|
|
unless (defined $hash_data) { |
|
72
|
0
|
|
|
|
|
|
my $hash = $changed->load_new_hash($file); |
|
73
|
0
|
|
|
|
|
|
$filehash->save_hash($file, $hash); |
|
74
|
0
|
|
|
|
|
|
push (@changed_files, $file); |
|
75
|
|
|
|
|
|
|
} else { |
|
76
|
0
|
0
|
|
|
|
|
if($changed->is_file_changed($file, $hash_data)) { |
|
77
|
0
|
|
|
|
|
|
push (@changed_files, $file); |
|
78
|
|
|
|
|
|
|
} |
|
79
|
|
|
|
|
|
|
} |
|
80
|
0
|
|
|
|
|
|
}); |
|
81
|
|
|
|
|
|
|
|
|
82
|
0
|
|
|
|
|
|
$self->model->insert_history( |
|
83
|
|
|
|
|
|
|
scalar(@changed_files) . " changed files found", "Daje::Workflow::FileChanged::Activity", 0 |
|
84
|
|
|
|
|
|
|
); |
|
85
|
|
|
|
|
|
|
|
|
86
|
0
|
0
|
|
|
|
|
if (@changed_files > 0) { |
|
87
|
0
|
|
|
|
|
|
$self->context->{context}->{changed_files} = \@changed_files; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
__END__ |