diff options
author | Frédéric Buclin <LpSolit@gmail.com> | 2011-01-30 13:07:59 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2011-01-30 13:07:59 +0100 |
commit | 8fa9965e5476717e574f2674c6df8c4487874634 (patch) | |
tree | 91c01615dbb0b6d2b576c2311f578a0ae7c44b29 /Bugzilla/User.pm | |
parent | 95bfc797b43bd7f1d8f45ea629aa6119b51e8a29 (diff) | |
download | bugzilla-8fa9965e5476717e574f2674c6df8c4487874634.tar.gz bugzilla-8fa9965e5476717e574f2674c6df8c4487874634.tar.xz |
Bug 616185: Move tags (aka lists of bugs) to their own DB tables
r/a=mkanat
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r-- | Bugzilla/User.pm | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index eafda6563..0b639ee0d 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -363,6 +363,24 @@ sub queries_available { return $self->{queries_available}; } +sub tags { + my $self = shift; + my $dbh = Bugzilla->dbh; + + if (!defined $self->{tags}) { + # We must use LEFT JOIN instead of INNER JOIN as we may be + # in the process of inserting a new tag to some bugs, + # in which case there are no bugs with this tag yet. + $self->{tags} = $dbh->selectall_hashref( + 'SELECT name, id, COUNT(bug_id) AS bug_count + FROM tags + LEFT JOIN bug_tag ON bug_tag.tag_id = tags.id + WHERE user_id = ? ' . $dbh->sql_group_by('id', 'name'), + 'name', undef, $self->id); + } + return $self->{tags}; +} + ########################## # Saved Recent Bug Lists # ########################## @@ -2074,6 +2092,11 @@ internally, such code must call this method to flush the cached result. An arrayref of group ids. The user can share their own queries with these groups. +=item C<tags> + +Returns a hashref with tag IDs as key, and a hashref with tag 'id', +'name' and 'bug_count' as value. + =back =head2 Account Lockout |