Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
51bdc50c
Commit
51bdc50c
authored
Apr 08, 2010
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 69621: Remove the keyword cache (which is not updated on keyword rename/delete)
r/a=mkanat
parent
f73a86bf
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
170 deletions
+13
-170
Bug.pm
Bugzilla/Bug.pm
+0
-2
Schema.pm
Bugzilla/DB/Schema.pm
+0
-4
DB.pm
Bugzilla/Install/DB.pm
+3
-43
Search.pm
Bugzilla/Search.pm
+8
-1
sanitycheck.cgi
sanitycheck.cgi
+1
-92
messages.html.tmpl
template/en/default/admin/sanitycheck/messages.html.tmpl
+0
-17
messages.html.tmpl
template/en/default/global/messages.html.tmpl
+1
-11
No files found.
Bugzilla/Bug.pm
View file @
51bdc50c
...
...
@@ -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
);
...
...
Bugzilla/DB/Schema.pm
View file @
51bdc50c
...
...
@@ -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'
,
...
...
Bugzilla/Install/DB.pm
View file @
51bdc50c
...
...
@@ -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
)
=
(
@_
);
...
...
Bugzilla/Search.pm
View file @
51bdc50c
...
...
@@ -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
);
}
...
...
sanitycheck.cgi
View file @
51bdc50c
...
...
@@ -88,7 +88,6 @@ print $cgi->header() unless Bugzilla->usage_mode == USAGE_MODE_CMDLINE;
# As this script can now alter the group_control_map table, we no longer
# let users with editbugs privs run it anymore.
$user
->
in_group
(
"editcomponents"
)
||
(
$user
->
in_group
(
'editkeywords'
)
&&
$cgi
->
param
(
'rebuildkeywordcache'
))
||
ThrowUserError
(
"auth_failure"
,
{
group
=>
"editcomponents"
,
action
=>
"run"
,
object
=>
"sanity_check"
});
...
...
@@ -99,18 +98,6 @@ unless (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
}
###########################################################################
# Users with 'editkeywords' privs only can only check keywords.
###########################################################################
unless
(
$user
->
in_group
(
'editcomponents'
))
{
check_keywords
();
Status
(
'checks_completed'
);
$template
->
process
(
'global/footer.html.tmpl'
,
$vars
)
||
ThrowTemplateError
(
$template
->
error
());
exit
;
}
###########################################################################
# Create missing group_control_map entries
###########################################################################
...
...
@@ -658,18 +645,13 @@ while (my ($id, $email) = $sth->fetchrow_array) {
}
###########################################################################
# Perform keyword c
ache c
hecks
# Perform keyword checks
###########################################################################
sub
check_keywords
{
my
$dbh
=
Bugzilla
->
dbh
;
my
$cgi
=
Bugzilla
->
cgi
;
my
%
keyword
=
@
{
$dbh
->
selectcol_arrayref
(
q{SELECT bug_id, keywords FROM bugs WHERE keywords != ''}
,
{
Columns
=>
[
1
,
2
]})
};
Status
(
'keyword_check_start'
);
my
%
keywordids
;
...
...
@@ -703,79 +685,6 @@ sub check_keywords {
$lastid
=
$id
;
$lastk
=
$k
;
}
Status
(
'keyword_cache_start'
);
if
(
$cgi
->
param
(
'rebuildkeywordcache'
))
{
$dbh
->
bz_start_transaction
();
}
my
$query
=
q{SELECT keywords.bug_id, keyworddefs.name
FROM keywords
INNER JOIN keyworddefs
ON keyworddefs.id = keywords.keywordid
INNER JOIN bugs
ON keywords.bug_id = bugs.bug_id
ORDER BY keywords.bug_id, keyworddefs.name}
;
$sth
=
$dbh
->
prepare
(
$query
);
$sth
->
execute
;
my
$lastb
=
0
;
my
@list
;
my
%
realk
;
while
(
1
)
{
my
(
$b
,
$k
)
=
$sth
->
fetchrow_array
;
if
(
!
defined
$b
||
$b
!=
$lastb
)
{
if
(
@list
)
{
$realk
{
$lastb
}
=
join
(
', '
,
@list
);
}
last
unless
$b
;
$lastb
=
$b
;
@list
=
();
}
push
(
@list
,
$k
);
}
my
@badbugs
=
();
foreach
my
$b
(
keys
(
%
keyword
))
{
if
(
!
exists
$realk
{
$b
}
||
$realk
{
$b
}
ne
$keyword
{
$b
})
{
push
(
@badbugs
,
$b
);
}
}
foreach
my
$b
(
keys
(
%
realk
))
{
if
(
!
exists
$keyword
{
$b
})
{
push
(
@badbugs
,
$b
);
}
}
if
(
@badbugs
)
{
@badbugs
=
sort
{
$a
<=>
$b
}
@badbugs
;
if
(
$cgi
->
param
(
'rebuildkeywordcache'
))
{
my
$sth_update
=
$dbh
->
prepare
(
q{UPDATE bugs
SET keywords = ?
WHERE bug_id = ?}
);
Status
(
'keyword_cache_fixing'
);
foreach
my
$b
(
@badbugs
)
{
my
$k
=
''
;
if
(
exists
(
$realk
{
$b
}))
{
$k
=
$realk
{
$b
};
}
$sth_update
->
execute
(
$k
,
$b
);
}
Status
(
'keyword_cache_fixed'
);
}
else
{
Status
(
'keyword_cache_alert'
,
{
badbugs
=>
\
@badbugs
},
'alert'
);
Status
(
'keyword_cache_rebuild'
);
}
}
if
(
$cgi
->
param
(
'rebuildkeywordcache'
))
{
$dbh
->
bz_commit_transaction
();
}
}
###########################################################################
...
...
template/en/default/admin/sanitycheck/messages.html.tmpl
View file @
51bdc50c
...
...
@@ -222,23 +222,6 @@
[% ELSIF san_tag == "keyword_check_duplicated_ids" %]
Duplicate keyword IDs found in [% PROCESS bug_link bug_id = id %].
[% ELSIF san_tag == "keyword_cache_start" %]
Checking cached keywords.
[% ELSIF san_tag == "keyword_cache_alert" %]
[% badbugs.size FILTER none %] [%+ terms.bugs %] found with
incorrect keyword cache: [% INCLUDE bug_list badbugs = badbugs %]
[% ELSIF san_tag == "keyword_cache_fixing" %]
OK, now fixing keyword cache.
[% ELSIF san_tag == "keyword_cache_fixed" %]
Keyword cache fixed.
[% ELSIF san_tag == "keyword_cache_rebuild" %]
<a href="sanitycheck.cgi?rebuildkeywordcache=1">Click here to
rebuild the keyword cache</a>.
[% ELSIF san_tag == "profile_login_start" %]
Checking profile logins.
...
...
template/en/default/global/messages.html.tmpl
View file @
51bdc50c
...
...
@@ -459,10 +459,6 @@
[% ELSIF message_tag == "keyword_deleted" %]
[% title = "Keyword Deleted" %]
The <em>[% keyword.name FILTER html %]</em> keyword has been deleted.
<b>After you have finished editing keywords, you need to
<a href="sanitycheck.cgi?rebuildkeywordcache=1">rebuild the keyword
cache</a></b> (on a very large installation of [% terms.Bugzilla %],
this can take several minutes).
[% ELSIF message_tag == "keyword_updated" %]
[% title = "Keyword Updated" %]
...
...
@@ -471,13 +467,7 @@
been saved:
<ul>
[% IF changes.name.defined %]
<li>
Keyword renamed to <em>[% keyword.name FILTER html %]</em>.
<b>After you have finished editing keywords, you need to
<a href="sanitycheck.cgi?rebuildkeywordcache=1">rebuild
the keyword cache</a></b> (on a very large installation
of [% terms.Bugzilla %], this can take several minutes).
</li>
<li>Keyword renamed to <em>[% keyword.name FILTER html %]</em>.</li>
[% END %]
[% IF changes.description.defined %]
<li>Description updated to <em>[% keyword.description FILTER html %]</em></li>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment