| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::bif::drop::topic; |
|
2
|
1
|
|
|
1
|
|
3931
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
30
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
26
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use Bif::Mo; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.5_6'; |
|
7
|
|
|
|
|
|
|
extends 'App::bif'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
|
10
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
|
11
|
1
|
|
|
|
|
4
|
my $opts = $self->opts; |
|
12
|
1
|
|
|
|
|
6
|
my $dbw = $self->dbw; |
|
13
|
0
|
|
|
|
|
|
my $info = $self->get_node( $opts->{id}, 'topic' ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
if ( !$opts->{force} ) { |
|
16
|
0
|
|
|
|
|
|
print "Nothing dropped (missing --force, -f)\n"; |
|
17
|
0
|
|
|
|
|
|
return $self->ok('DropNoForce'); |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
my $uuid = substr( $info->{uuid}, 0, 8 ); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
$dbw->txn( |
|
23
|
|
|
|
|
|
|
sub { |
|
24
|
0
|
|
|
0
|
|
|
$self->start_work( |
|
25
|
|
|
|
|
|
|
start => time, |
|
26
|
|
|
|
|
|
|
start_comment => "drop topic $info->{id} <$uuid>", |
|
27
|
|
|
|
|
|
|
billable => 0, |
|
28
|
|
|
|
|
|
|
save => 1, |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# TODO: copy existing work_deltas rows into work_buffers |
|
32
|
|
|
|
|
|
|
# with NULL node_id so that the work activity is not lost. |
|
33
|
|
|
|
|
|
|
# Perhaps a new --no-work-buffer option or similar to |
|
34
|
|
|
|
|
|
|
# disable that behaviour. |
|
35
|
|
|
|
|
|
|
$dbw->xdo( |
|
36
|
|
|
|
|
|
|
delete_from => 'topics', |
|
37
|
|
|
|
|
|
|
where => { id => $info->{id} }, |
|
38
|
0
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
print "Topic dropped: $info->{id} <$uuid>\n"; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$self->stop_work( |
|
43
|
|
|
|
|
|
|
stop => time, |
|
44
|
|
|
|
|
|
|
restore => 1, |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
0
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
return $self->ok('Drop'. ucfirst($info->{tkind})); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
|
53
|
|
|
|
|
|
|
__END__ |