line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::bif::drop::topic; |
2
|
1
|
|
|
1
|
|
5322
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
4
|
1
|
|
|
1
|
|
7
|
use Bif::Mo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.1.5_7'; |
7
|
|
|
|
|
|
|
extends 'App::bif'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub run { |
10
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
11
|
1
|
|
|
|
|
6
|
my $opts = $self->opts; |
12
|
1
|
|
|
|
|
9
|
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
|
|
|
|
|
|
|
# TODO: copy existing work_deltas rows into work_buffers |
25
|
|
|
|
|
|
|
# with NULL node_id so that the work activity is not lost. |
26
|
|
|
|
|
|
|
# Perhaps a new --no-work-buffer option or similar to |
27
|
|
|
|
|
|
|
# disable that behaviour. |
28
|
|
|
|
|
|
|
$dbw->xdo( |
29
|
|
|
|
|
|
|
delete_from => 'topics', |
30
|
|
|
|
|
|
|
where => { id => $info->{id} }, |
31
|
0
|
|
|
0
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
print "Topic dropped: $info->{id} <$uuid>\n"; |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->ok( 'Drop' . ucfirst( $info->{tkind} ) ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
__END__ |