summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2010-04-08 12:12:42 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2010-04-08 12:12:42 +0200
commit51bdc50c7ff7caab9c57a67d9cc168347e2d1a11 (patch)
tree9d9a0ea35e8bfeacdd71effba5a5c19642130a5e /Bugzilla
parentf73a86bf700c8b3e85be84966171cdc8527a204a (diff)
downloadbugzilla-51bdc50c7ff7caab9c57a67d9cc168347e2d1a11.tar.gz
bugzilla-51bdc50c7ff7caab9c57a67d9cc168347e2d1a11.tar.xz
Bug 69621: Remove the keyword cache (which is not updated on keyword rename/delete)
r/a=mkanat
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Bug.pm2
-rw-r--r--Bugzilla/DB/Schema.pm4
-rw-r--r--Bugzilla/Install/DB.pm46
-rw-r--r--Bugzilla/Search.pm9
4 files changed, 11 insertions, 50 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 89e47a70f..bfcca1076 100644
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -703,8 +703,6 @@ sub update {
$dbh->do('INSERT INTO keywords (bug_id, keywordid) VALUES (?,?)',
undef, $self->id, $keyword_id);
}
- $dbh->do('UPDATE bugs SET keywords = ? WHERE bug_id = ?', undef,
- $self->keywords, $self->id);
# If any changes were found, record it in the activity log
if (scalar @$removed_kw || scalar @$added_kw) {
my $removed_keywords = Bugzilla::Keyword->new_from_list($removed_kw);
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 082fde7ef..6520766f3 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -273,10 +273,6 @@ use constant ABSTRACT_SCHEMA => {
COLUMN => 'userid'}},
status_whiteboard => {TYPE => 'MEDIUMTEXT', NOTNULL => 1,
DEFAULT => "''"},
- # Note: keywords field is only a cache; the real data
- # comes from the keywords table
- keywords => {TYPE => 'MEDIUMTEXT', NOTNULL => 1,
- DEFAULT => "''"},
lastdiffed => {TYPE => 'DATETIME'},
everconfirmed => {TYPE => 'BOOLEAN', NOTNULL => 1},
reporter_accessible => {TYPE => 'BOOLEAN',
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 1a3ffc69b..81372da71 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -147,7 +147,6 @@ sub update_table_definitions {
_add_bug_vote_cache();
_update_product_name_definition();
- _add_bug_keyword_cache();
$dbh->bz_add_column('profiles', 'disabledtext',
{TYPE => 'MEDIUMTEXT', NOTNULL => 1}, '');
@@ -358,8 +357,6 @@ sub update_table_definitions {
# Add defaults for some fields that should have them but didn't.
$dbh->bz_alter_column('bugs', 'status_whiteboard',
{TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});
- $dbh->bz_alter_column('bugs', 'keywords',
- {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});
if ($dbh->bz_column_info('bugs', 'votes')) {
$dbh->bz_alter_column('bugs', 'votes',
{TYPE => 'INT3', NOTNULL => 1, DEFAULT => '0'});
@@ -605,6 +602,9 @@ sub update_table_definitions {
# 2009-11-14 dkl@redhat.com - Bug 310450
$dbh->bz_add_column('bugs_activity', 'comment_id', {TYPE => 'INT3'});
+ # 2010-04-07 LpSolit@gmail.com - Bug 69621
+ $dbh->bz_drop_column('bugs', 'keywords');
+
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
@@ -691,46 +691,6 @@ sub _update_product_name_definition {
}
}
-sub _add_bug_keyword_cache {
- my $dbh = Bugzilla->dbh;
- # 2000-01-16 Added a "keywords" field to the bugs table, which
- # contains a string copy of the entries of the keywords table for this
- # bug. This is so that I can easily sort and display a keywords
- # column in bug lists.
-
- if (!$dbh->bz_column_info('bugs', 'keywords')) {
- $dbh->bz_add_column('bugs', 'keywords',
- {TYPE => 'MEDIUMTEXT', NOTNULL => 1, DEFAULT => "''"});
-
- my @kwords;
- print "Making sure 'keywords' field of table 'bugs' is empty...\n";
- $dbh->do("UPDATE bugs SET keywords = '' WHERE keywords != ''");
- print "Repopulating 'keywords' field of table 'bugs'...\n";
- my $sth = $dbh->prepare("SELECT keywords.bug_id, keyworddefs.name " .
- "FROM keywords, keyworddefs " .
- "WHERE keyworddefs.id = keywords.keywordid " .
- "ORDER BY keywords.bug_id, keyworddefs.name");
- $sth->execute;
- my @list;
- my $bugid = 0;
- my @row;
- while (1) {
- my ($b, $k) = ($sth->fetchrow_array());
- if (!defined $b || $b ne $bugid) {
- if (@list) {
- $dbh->do("UPDATE bugs SET keywords = " .
- $dbh->quote(join(', ', @list)) .
- " WHERE bug_id = $bugid");
- }
- last if !$b;
- $bugid = $b;
- @list = ();
- }
- push(@list, $k);
- }
- }
-}
-
# A helper for the function below.
sub _write_one_longdesc {
my ($id, $who, $when, $buffer) = (@_);
diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm
index a0d9718ec..6a9d05144 100644
--- a/Bugzilla/Search.pm
+++ b/Bugzilla/Search.pm
@@ -126,6 +126,8 @@ sub COLUMNS {
'flagtypes.name' => $dbh->sql_group_concat('DISTINCT '
. $dbh->sql_string_concat('flagtypes.name', 'flags.status'), "', '"),
+
+ 'keywords' => $dbh->sql_group_concat('DISTINCT keyworddefs.name', "', '"),
);
# Backward-compatibility for old field names. Goes new_name => old_name.
@@ -295,6 +297,11 @@ sub init {
push(@supptables, "LEFT JOIN flagtypes ON flagtypes.id = flags.type_id");
}
+ if (grep($_ eq 'keywords', @fields)) {
+ push(@supptables, "LEFT JOIN keywords ON keywords.bug_id = bugs.bug_id");
+ push(@supptables, "LEFT JOIN keyworddefs ON keyworddefs.id = keywords.keywordid");
+ }
+
# If the user has selected all of either status or resolution, change to
# selecting none. This is functionally equivalent, but quite a lot faster.
# Also, if the status is __open__ or __closed__, translate those
@@ -960,7 +967,7 @@ sub init {
# These fields never go into the GROUP BY (bug_id goes in
# explicitly, below).
next if (grep($_ eq $field, EMPTY_COLUMN,
- qw(bug_id actual_time percentage_complete flagtypes.name)));
+ qw(bug_id actual_time percentage_complete flagtypes.name keywords)));
my $col = COLUMNS->{$field}->{name};
push(@groupby, $col) if !grep($_ eq $col, @groupby);
}