line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::log::topic; |
2
|
1
|
|
|
1
|
|
5308
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
38
|
|
4
|
1
|
|
|
1
|
|
7
|
use feature 'state'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
104
|
|
5
|
1
|
|
|
1
|
|
6
|
use Bif::Mo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.1.5_6'; |
8
|
|
|
|
|
|
|
extends 'App::bif::log'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub run { |
11
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
12
|
1
|
|
|
|
|
4
|
my $opts = $self->opts; |
13
|
1
|
|
|
|
|
8
|
my $db = $self->db; |
14
|
0
|
|
|
|
|
|
my $info = $self->get_node( $opts->{id}, 'topic' ); |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
state $have_dbix = DBIx::ThinSQL->import(qw/ qv concat coalesce/); |
17
|
0
|
|
|
|
|
|
my $now = $self->now; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $sth = $db->xprepare( |
20
|
|
|
|
|
|
|
select => [ |
21
|
|
|
|
|
|
|
'ltd.topic_id AS id', |
22
|
|
|
|
|
|
|
'n.uuid AS uuid', |
23
|
|
|
|
|
|
|
concat( qv('c'), 'ltd.change_id' )->as('change_id'), |
24
|
|
|
|
|
|
|
'c.uuid AS change_uuid', |
25
|
|
|
|
|
|
|
'ltd.title', |
26
|
|
|
|
|
|
|
'c.mtime AS mtime', |
27
|
|
|
|
|
|
|
"c.mtimetz AS mtimetz", |
28
|
|
|
|
|
|
|
'c.mtimetzhm AS mtimetzhm', |
29
|
|
|
|
|
|
|
"$now - c.mtime AS mtime_age", |
30
|
|
|
|
|
|
|
'c.action', |
31
|
|
|
|
|
|
|
'COALESCE(c.author,e.name) AS author', |
32
|
|
|
|
|
|
|
"COALESCE(c.author_contact_method || ': ' || " |
33
|
|
|
|
|
|
|
. "c.author_contact, ecm.method || ': ' || " |
34
|
|
|
|
|
|
|
. "ecm.mvalue) AS contact", |
35
|
|
|
|
|
|
|
'ts.status', |
36
|
|
|
|
|
|
|
'ts.status', |
37
|
|
|
|
|
|
|
'p.title AS project_title', |
38
|
|
|
|
|
|
|
'ct.depth', |
39
|
|
|
|
|
|
|
'c.message', |
40
|
|
|
|
|
|
|
], |
41
|
|
|
|
|
|
|
from => 'topics t', |
42
|
|
|
|
|
|
|
inner_join => 'link_topic_deltas ltd', |
43
|
|
|
|
|
|
|
on => 'ltd.link_topic_id = t.link_topic_id', |
44
|
|
|
|
|
|
|
inner_join => 'changes c', |
45
|
|
|
|
|
|
|
on => 'c.id = ltd.change_id', |
46
|
|
|
|
|
|
|
inner_join => 'entities e', |
47
|
|
|
|
|
|
|
on => 'e.id = c.identity_id', |
48
|
|
|
|
|
|
|
inner_join => 'entity_contact_methods ecm', |
49
|
|
|
|
|
|
|
on => 'ecm.id = e.default_contact_method_id', |
50
|
|
|
|
|
|
|
inner_join => 'nodes n', |
51
|
|
|
|
|
|
|
on => 'n.id = t.id', |
52
|
|
|
|
|
|
|
left_join => 'topic_status ts', |
53
|
|
|
|
|
|
|
on => 'ts.id = ltd.topic_status_id', |
54
|
|
|
|
|
|
|
left_join => 'projects p', |
55
|
|
|
|
|
|
|
on => 'p.id = ts.project_id', |
56
|
|
|
|
|
|
|
left_join => 'hubs h', |
57
|
|
|
|
|
|
|
on => 'h.id = p.default_hub_id', |
58
|
|
|
|
|
|
|
inner_join => 'changes_tree ct', |
59
|
|
|
|
|
|
|
on => { |
60
|
|
|
|
|
|
|
'ct.parent' => $info->{first_change_id}, |
61
|
|
|
|
|
|
|
'ct.child' => \'ltd.change_id' |
62
|
|
|
|
|
|
|
}, |
63
|
|
|
|
|
|
|
where => { 't.id' => $info->{id} }, |
64
|
0
|
|
|
|
|
|
order_by => 'c.path ASC', |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$sth->execute; |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
|
$self->start_pager; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $first = $sth->hashref; |
72
|
0
|
|
|
|
|
|
$first->{ctime} = $first->{mtime}; |
73
|
0
|
|
|
|
|
|
$first->{ctimetz} = $first->{mtimetz}; |
74
|
0
|
|
|
|
|
|
$first->{ctimetzhm} = $first->{mtimetzhm}; |
75
|
0
|
|
|
|
|
|
$first->{ctime_age} = $first->{mtime_age}; |
76
|
0
|
|
|
|
|
|
$self->log_item( $first, 'topic' ); |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
$self->log_comment($_) for $sth->hashrefs; |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
return $self->ok( 'Log' . ucfirst( $info->{tkind} ) ); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
__END__ |