line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2017 Koha-Suomi |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This file is part of Pootle-Client. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Pootle::Resource::Store; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
277
|
use Modern::Perl '2015'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
91
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
9
|
|
|
|
|
|
|
binmode STDOUT, ':encoding(UTF-8)'; |
10
|
|
|
|
|
|
|
binmode STDERR, ':encoding(UTF-8)'; |
11
|
1
|
|
|
1
|
|
30
|
use feature 'signatures'; no warnings "experimental::signatures"; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
12
|
1
|
|
|
1
|
|
4
|
use Carp::Always; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
13
|
1
|
|
|
1
|
|
3
|
use Try::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
14
|
1
|
|
|
1
|
|
5
|
use Scalar::Util qw(blessed); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 Pootle::Resource::Store |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Pootle object |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
4
|
use base('Pootle::Resource'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
76
|
|
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Params::Validate qw(:all); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
113
|
|
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
1
|
|
6
|
use Pootle::Logger; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
my $l = bless({}, 'Pootle::Logger'); #Lazy load package logger this way to avoid circular dependency issues with logger includes from many packages |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
0
|
|
sub new($class, @params) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
$l->debug("Initializing ".__PACKAGE__." with parameters: ".$l->flatten(@params)) if $l->is_debug(); |
31
|
0
|
|
|
|
|
|
my %self = validate(@params, { |
32
|
|
|
|
|
|
|
file => 1, #eg. "/media/Firefox/fr/chrome/global/languageNames.properties.po" |
33
|
|
|
|
|
|
|
name => 1, #eg. "languageNames.properties.po" |
34
|
|
|
|
|
|
|
pending => 0, #eg. null |
35
|
|
|
|
|
|
|
pootle_path => 1, #eg. "fr/firefox/chrome/global/languageNames.properties.po" |
36
|
|
|
|
|
|
|
resource_uri => 1, #eg. "/api/v1/stores/76/" |
37
|
|
|
|
|
|
|
state => 1, #eg. 2 |
38
|
|
|
|
|
|
|
sync_time => 1, #eg. "2013-03-15T20:10:35.070238" |
39
|
|
|
|
|
|
|
tm => 0, #eg. null |
40
|
|
|
|
|
|
|
translation_project => 1, #eg. "/api/v1/translation-projects/65/" |
41
|
|
|
|
|
|
|
units => 1, #eg. [ '/api/v1/units/70316/', ... ] |
42
|
|
|
|
|
|
|
}); |
43
|
0
|
|
|
|
|
|
my $s = bless(\%self, $class); |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
return $s; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
0
|
1
|
|
sub file($s) { return $s->{file} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
0
|
1
|
|
sub name($s) { return $s->{name} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
1
|
|
sub pending($s) { return $s->{pending} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
0
|
1
|
|
sub pootle_path($s) { return $s->{pootle_path} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
52
|
0
|
|
|
0
|
1
|
|
sub resource_uri($s) { return $s->{resource_uri} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
53
|
0
|
|
|
0
|
1
|
|
sub state($s) { return $s->{state} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
1
|
|
sub sync_time($s) { return $s->{sync_time} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
55
|
0
|
|
|
0
|
1
|
|
sub tm($s) { return $s->{tm} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
56
|
0
|
|
|
0
|
1
|
|
sub translation_project($s) { return $s->{translation_project} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
57
|
0
|
|
|
0
|
1
|
|
sub units($s) { return $s->{units} } |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 Accessors |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=over 4 |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item B |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item B |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item B |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item B |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item B |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item B |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item B |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item B |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item B |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item B |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=cut |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |