1# This Source Code Form is subject to the terms of the Mozilla Public 2# License, v. 2.0. If a copy of the MPL was not distributed with this 3# file, You can obtain one at http://mozilla.org/MPL/2.0/. 4# 5# This Source Code Form is "Incompatible With Secondary Licenses", as 6# defined by the Mozilla Public License, v. 2.0. 7 8package Bugzilla::Comment::TagWeights; 9 10use 5.10.1; 11use strict; 12use warnings; 13 14use parent qw(Bugzilla::Object); 15 16use Bugzilla::Constants; 17 18# No auditing required 19use constant AUDIT_CREATES => 0; 20use constant AUDIT_UPDATES => 0; 21use constant AUDIT_REMOVES => 0; 22 23use constant DB_COLUMNS => qw( 24 id 25 tag 26 weight 27); 28 29use constant UPDATE_COLUMNS => qw( 30 weight 31); 32 33use constant DB_TABLE => 'longdescs_tags_weights'; 34use constant ID_FIELD => 'id'; 35use constant NAME_FIELD => 'tag'; 36use constant LIST_ORDER => 'weight DESC'; 37use constant VALIDATORS => { }; 38 39# There's no gain to caching these objects 40use constant USE_MEMCACHED => 0; 41 42sub tag { return $_[0]->{'tag'} } 43sub weight { return $_[0]->{'weight'} } 44 45sub set_weight { $_[0]->set('weight', $_[1]); } 46 471; 48 49=head1 NAME 50 51Comment::TagWeights - Bugzilla comment weighting class. 52 53=head1 DESCRIPTION 54 55TagWeights.pm represents a Comment::TagWeight object. It is an implementation 56of L<Bugzilla::Object>, and thus provides all methods that L<Bugzilla::Object> 57provides. 58 59TagWeights is used to quickly find tags and order by their usage count. 60 61=head1 PROPERTIES 62 63=over 64 65=item C<tag> 66 67C<getter string> The tag 68 69=item C<weight> 70 71C<getter int> The tag's weight. The value returned corresponds to the number of 72comments with this tag attached. 73 74=item C<set_weight> 75 76C<setter int> Set the tag's weight. 77 78=back 79