Skip to content

Commit 32272f8

Browse files
committed
Merge branch 'master' into harmony
2 parents 7775a0c + cfb84c6 commit 32272f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+581
-78
lines changed

Bugzilla/Attachment.pm

+7
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ use constant UPDATE_VALIDATORS => {
113113
#### Accessors ######
114114
###############################
115115

116+
use Class::XSAccessor {
117+
accessors => {
118+
id => __PACKAGE__->ID_FIELD,
119+
name => __PACKAGE__->NAME_FIELD,
120+
},
121+
};
122+
116123
=pod
117124
118125
=head2 Instance Properties

Bugzilla/Bug.pm

+8
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ my %CLEANUP;
5454

5555
use constant DB_TABLE => 'bugs';
5656
use constant ID_FIELD => 'bug_id';
57+
5758
use constant NAME_FIELD => 'alias';
59+
use Class::XSAccessor {
60+
accessors => {
61+
id => __PACKAGE__->ID_FIELD,
62+
name => __PACKAGE__->NAME_FIELD,
63+
},
64+
};
65+
5866
use constant LIST_ORDER => ID_FIELD;
5967
# Bugs have their own auditing table, bugs_activity.
6068
use constant AUDIT_CREATES => 0;

Bugzilla/BugUrl.pm

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ use constant SUB_CLASSES => qw(
7474
#### Accessors ######
7575
###############################
7676

77+
use Class::XSAccessor {
78+
accessors => {
79+
name => __PACKAGE__->NAME_FIELD,
80+
id => __PACKAGE__->ID_FIELD,
81+
},
82+
};
83+
7784
sub class { return $_[0]->{class} }
7885
sub bug_id { return $_[0]->{bug_id} }
7986

Bugzilla/BugUserLastVisit.pm

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ use constant { AUDIT_CREATES => 0,
3030
AUDIT_REMOVES => 0,
3131
USE_MEMCACHED => 0 };
3232

33+
use Class::XSAccessor {
34+
accessors => {
35+
name => __PACKAGE__->NAME_FIELD,
36+
id => __PACKAGE__->ID_FIELD,
37+
},
38+
};
39+
3340
#####################################################################
3441
# Provide accessors for our columns
3542
#####################################################################
3643

37-
sub id { return $_[0]->{id} }
3844
sub bug_id { return $_[0]->{bug_id} }
3945
sub user_id { return $_[0]->{user_id} }
4046
sub last_visit_ts { return $_[0]->{last_visit_ts} }

Bugzilla/Classification.pm

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ use constant VALIDATORS => {
4747
sortkey => \&_check_sortkey,
4848
};
4949

50+
###############################
51+
#### Accessors ######
52+
###############################
53+
54+
use Class::XSAccessor {
55+
accessors => {
56+
id => __PACKAGE__->ID_FIELD,
57+
name => __PACKAGE__->NAME_FIELD,
58+
},
59+
};
60+
5061
###############################
5162
#### Constructors #####
5263
###############################

Bugzilla/Comment.pm

+7
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ sub preload {
228228
#### Accessors ######
229229
###############################
230230

231+
use Class::XSAccessor {
232+
accessors => {
233+
id => __PACKAGE__->ID_FIELD,
234+
name => __PACKAGE__->NAME_FIELD,
235+
},
236+
};
237+
231238
sub already_wrapped { return $_[0]->{'already_wrapped'}; }
232239
sub body { return $_[0]->{'thetext'}; }
233240
sub bug_id { return $_[0]->{'bug_id'}; }

Bugzilla/Comment/TagWeights.pm

+12-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,18 @@ use constant VALIDATORS => { };
3939
# There's no gain to caching these objects
4040
use constant USE_MEMCACHED => 0;
4141

42-
sub tag { return $_[0]->{'tag'} }
42+
###############################
43+
#### Accessors ######
44+
###############################
45+
46+
use Class::XSAccessor {
47+
accessors => {
48+
id => __PACKAGE__->ID_FIELD,
49+
tag => __PACKAGE__->NAME_FIELD,
50+
name => __PACKAGE__->NAME_FIELD,
51+
},
52+
};
53+
4354
sub weight { return $_[0]->{'weight'} }
4455

4556
sub set_weight { $_[0]->set('weight', $_[1]); }

Bugzilla/Component.pm

+7
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,13 @@ sub is_active { return $_[0]->{'isactive'}; }
447447

448448
sub triage_owner_id { return $_[0]->{'triage_owner_id'} }
449449

450+
use Class::XSAccessor {
451+
accessors => {
452+
id => __PACKAGE__->ID_FIELD,
453+
name => __PACKAGE__->NAME_FIELD,
454+
},
455+
};
456+
450457
##############################################
451458
# Implement Bugzilla::Field::ChoiceInterface #
452459
##############################################

Bugzilla/Field.pm

+11
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,17 @@ sub _check_reverse_desc {
432432

433433
sub _check_is_mandatory { return $_[1] ? 1 : 0; }
434434

435+
###############################
436+
#### Accessors ######
437+
###############################
438+
439+
use Class::XSAccessor {
440+
accessors => {
441+
id => __PACKAGE__->ID_FIELD,
442+
name => __PACKAGE__->NAME_FIELD,
443+
},
444+
};
445+
435446
=pod
436447
437448
=head2 Instance Properties

Bugzilla/Field/Choice.pm

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ sub new {
119119
$class->SUPER::new(@_);
120120
}
121121

122+
###############################
123+
#### Accessors ######
124+
###############################
125+
126+
use Class::XSAccessor {
127+
accessors => {
128+
id => __PACKAGE__->ID_FIELD,
129+
name => __PACKAGE__->NAME_FIELD,
130+
},
131+
};
122132
#########################
123133
# Database Manipulation #
124134
#########################

Bugzilla/Flag.pm

+6-1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,12 @@ use constant UPDATE_VALIDATORS => {
104104
#### Accessors ######
105105
###############################
106106

107+
use Class::XSAccessor {
108+
accessors => {
109+
id => __PACKAGE__->ID_FIELD,
110+
},
111+
};
112+
107113
=head2 METHODS
108114
109115
=over
@@ -140,7 +146,6 @@ Returns the timestamp when the flag was last modified.
140146
141147
=cut
142148

143-
sub id { return $_[0]->{'id'}; }
144149
sub name { return $_[0]->type->name; }
145150
sub type_id { return $_[0]->{'type_id'}; }
146151
sub bug_id { return $_[0]->{'bug_id'}; }

Bugzilla/FlagType.pm

+7-2
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,13 @@ sub update {
210210
#### Accessors ######
211211
###############################
212212

213+
use Class::XSAccessor {
214+
accessors => {
215+
id => __PACKAGE__->ID_FIELD,
216+
name => __PACKAGE__->NAME_FIELD,
217+
},
218+
};
219+
213220
=head2 METHODS
214221
215222
=over
@@ -262,8 +269,6 @@ Returns the sortkey of the flagtype.
262269
263270
=cut
264271

265-
sub id { return $_[0]->{'id'}; }
266-
sub name { return $_[0]->{'name'}; }
267272
sub description { return $_[0]->{'description'}; }
268273
sub cc_list { return $_[0]->{'cc_list'}; }
269274
sub target_type { return $_[0]->{'target_type'} eq 'b' ? 'bug' : 'attachment'; }

Bugzilla/Group.pm

+7
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,13 @@ use constant GROUP_PARAMS => qw(chartgroup insidergroup timetrackinggroup
7171
#### Accessors ######
7272
###############################
7373

74+
use Class::XSAccessor {
75+
accessors => {
76+
id => __PACKAGE__->ID_FIELD,
77+
name => __PACKAGE__->NAME_FIELD,
78+
},
79+
};
80+
7481
sub description { return $_[0]->{'description'}; }
7582
sub is_bug_group { return $_[0]->{'isbuggroup'}; }
7683
sub user_regexp { return $_[0]->{'userregexp'}; }

Bugzilla/Keyword.pm

+7
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,13 @@ use constant UPDATE_COLUMNS => qw(
4747
#### Accessors ######
4848
###############################
4949

50+
use Class::XSAccessor {
51+
accessors => {
52+
id => __PACKAGE__->ID_FIELD,
53+
name => __PACKAGE__->NAME_FIELD,
54+
},
55+
};
56+
5057
sub description { return $_[0]->{'description'}; }
5158

5259
sub bug_count {

Bugzilla/Milestone.pm

+7-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,13 @@ sub bug_count {
227227
##### Accessors ######
228228
################################
229229

230-
sub name { return $_[0]->{'value'}; }
230+
use Class::XSAccessor {
231+
accessors => {
232+
id => __PACKAGE__->ID_FIELD,
233+
name => __PACKAGE__->NAME_FIELD,
234+
},
235+
};
236+
231237
sub product_id { return $_[0]->{'product_id'}; }
232238
sub sortkey { return $_[0]->{'sortkey'}; }
233239
sub is_active { return $_[0]->{'isactive'}; }

Bugzilla/Object.pm

-3
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,6 @@ sub _do_list_select {
445445
#### Accessors ######
446446
###############################
447447

448-
sub id { return $_[0]->{$_[0]->ID_FIELD}; }
449-
sub name { return $_[0]->{$_[0]->NAME_FIELD}; }
450-
451448
###############################
452449
#### Methods ####
453450
###############################

Bugzilla/Product.pm

+7
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,13 @@ sub classification {
831831
#### Accessors ######
832832
###############################
833833

834+
use Class::XSAccessor {
835+
accessors => {
836+
id => __PACKAGE__->ID_FIELD,
837+
name => __PACKAGE__->NAME_FIELD,
838+
},
839+
};
840+
834841
sub allows_unconfirmed { return $_[0]->{'allows_unconfirmed'}; }
835842
sub description { return $_[0]->{'description'}; }
836843
sub is_active { return $_[0]->{'isactive'}; }

Bugzilla/Search/Recent.pm

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ use constant LIST_ORDER => 'id DESC';
2727
use constant AUDIT_CREATES => 0;
2828
use constant AUDIT_UPDATES => 0;
2929
use constant AUDIT_REMOVES => 0;
30+
use constant USER_ID_FIELD => 'user_id';
31+
use constant ID_FIELD => 'id';
3032

3133
use constant DB_COLUMNS => qw(
3234
id
@@ -115,9 +117,16 @@ sub new_from_cookie {
115117
# Simple Accessors #
116118
####################
117119

120+
use Class::XSAccessor {
121+
accessors => {
122+
user_id => __PACKAGE__->USER_ID_FIELD,
123+
id => __PACKAGE__->ID_FIELD,
124+
name => __PACKAGE__->NAME_FIELD,
125+
},
126+
};
127+
118128
sub bug_list { return [split(',', $_[0]->{'bug_list'})]; }
119129
sub list_order { return $_[0]->{'list_order'}; }
120-
sub user_id { return $_[0]->{'user_id'}; }
121130

122131
############
123132
# Mutators #

Bugzilla/Search/Saved.pm

+7
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ sub shared_with_users {
287287
# Simple Accessors #
288288
####################
289289

290+
use Class::XSAccessor {
291+
accessors => {
292+
id => __PACKAGE__->ID_FIELD,
293+
name => __PACKAGE__->NAME_FIELD,
294+
},
295+
};
296+
290297
sub url { return $_[0]->{'query'}; }
291298

292299
sub user {

Bugzilla/User.pm

+8-1
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,16 @@ sub DB_COLUMNS {
8686

8787
use constant NAME_FIELD => 'login_name';
8888
use constant ID_FIELD => 'userid';
89+
use constant REAL_NAME_FIELD => 'realname';
8990
use constant LIST_ORDER => NAME_FIELD;
9091

92+
use Class::XSAccessor {
93+
accessors => {
94+
id => __PACKAGE__->ID_FIELD,
95+
name => __PACKAGE__->REAL_NAME_FIELD,
96+
},
97+
};
98+
9199
use constant VALIDATORS => {
92100
cryptpassword => \&_check_password,
93101
disable_mail => \&_check_disable_mail,
@@ -640,7 +648,6 @@ sub update_last_seen_date {
640648
################################################################################
641649

642650
# Accessors for user attributes
643-
sub name { $_[0]->{realname}; }
644651
sub login { $_[0]->{login_name}; }
645652
sub extern_id { $_[0]->{extern_id}; }
646653
sub email { $_[0]->login . Bugzilla->params->{'emailsuffix'}; }

Bugzilla/User/APIKey.pm

+11-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ use constant { AUDIT_CREATES => 0,
5050
USE_MEMCACHED => 0 };
5151

5252
# Accessors
53-
sub id { return $_[0]->{id} }
53+
###############################
54+
#### Accessors ######
55+
###############################
56+
57+
use Class::XSAccessor {
58+
accessors => {
59+
id => __PACKAGE__->ID_FIELD,
60+
name => __PACKAGE__->NAME_FIELD,
61+
},
62+
};
63+
5464
sub user_id { return $_[0]->{user_id} }
5565
sub api_key { return $_[0]->{api_key} }
5666
sub app_id { return $_[0]->{app_id} }

Bugzilla/User/Session.pm

+8-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ use constant { AUDIT_CREATES => 0,
3939
USE_MEMCACHED => 0 };
4040

4141
# Accessors
42-
sub id { return $_[0]->{id} }
42+
43+
use Class::XSAccessor {
44+
accessors => {
45+
id => __PACKAGE__->ID_FIELD,
46+
name => __PACKAGE__->NAME_FIELD,
47+
},
48+
};
49+
4350
sub userid { return $_[0]->{userid} }
4451
sub cookie { return $_[0]->{cookie} }
4552
sub lastused { return $_[0]->{lastused} }

Bugzilla/Version.pm

+8
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use constant DEFAULT_VERSION => 'unspecified';
2828

2929
use constant DB_TABLE => 'versions';
3030
use constant NAME_FIELD => 'value';
31+
3132
# This is "id" because it has to be filled in and id is probably the fastest.
3233
# We do a custom sort in new_from_list below.
3334
use constant LIST_ORDER => 'id';
@@ -147,6 +148,13 @@ sub remove_from_db {
147148
##### Accessors ####
148149
###############################
149150

151+
use Class::XSAccessor {
152+
accessors => {
153+
id => __PACKAGE__->ID_FIELD,
154+
name => __PACKAGE__->NAME_FIELD,
155+
},
156+
};
157+
150158
sub product_id { return $_[0]->{'product_id'}; }
151159
sub is_active { return $_[0]->{'isactive'}; }
152160

0 commit comments

Comments
 (0)