Remove rebuildkeywordcache, merge create and edit templates for keywords
parent
8dc199f65e
commit
0f82a1b8af
|
@ -67,7 +67,7 @@ if ($action eq "") {
|
|||
if ($action eq 'add') {
|
||||
$vars->{'token'} = issue_session_token('add_keyword');
|
||||
|
||||
$template->process("admin/keywords/create.html.tmpl", $vars)
|
||||
$template->process("admin/keywords/edit.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
exit;
|
||||
|
|
|
@ -36,12 +36,6 @@ foreach my $keyword (@keywords) {
|
|||
$sel->title_is("Keyword Deleted");
|
||||
}
|
||||
|
||||
# Even if no keyword has been deleted, make sure the cache is right.
|
||||
$sel->open_ok("/$config->{bugzilla_installation}/sanitycheck.cgi?rebuildkeywordcache=1");
|
||||
$sel->wait_for_page_to_load(WAIT_TIME);
|
||||
$sel->title_is("Sanity Check");
|
||||
$sel->is_text_present_ok("Sanity check completed.", undef, "Page displayed correctly");
|
||||
|
||||
# Now let's create our first keyword.
|
||||
|
||||
go_to_admin($sel);
|
||||
|
|
|
@ -38,9 +38,6 @@ $sel->is_text_present_ok("Sanity check completed.", undef, "Page displayed corre
|
|||
$sel->open_ok("/$config->{bugzilla_installation}/sanitycheck.cgi?remove_invalid_attach_references=1");
|
||||
$sel->title_is("Sanity Check", "Call sanitycheck.cgi with remove_invalid_attach_references=1");
|
||||
$sel->is_text_present_ok("Sanity check completed.", undef, "Page displayed correctly");
|
||||
$sel->open_ok("/$config->{bugzilla_installation}/sanitycheck.cgi?rebuildkeywordcache=1");
|
||||
$sel->title_is("Sanity Check", "Call sanitycheck.cgi with rebuildkeywordcache=1");
|
||||
$sel->is_text_present_ok("Sanity check completed.", undef, "Page displayed correctly");
|
||||
$sel->open_ok("/$config->{bugzilla_installation}/sanitycheck.cgi?remove_old_whine_targets=1");
|
||||
$sel->title_is("Sanity Check", "Call sanitycheck.cgi with remove_old_whine_targets=1");
|
||||
$sel->is_text_present_ok("Sanity check completed.", undef, "Page displayed correctly");
|
||||
|
|
134
sanitycheck.cgi
134
sanitycheck.cgi
|
@ -88,7 +88,6 @@ $cgi->send_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"});
|
||||
|
@ -98,11 +97,7 @@ unless (Bugzilla->usage_mode == USAGE_MODE_CMDLINE) {
|
|||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Users with 'editkeywords' privs only can only check keywords.
|
||||
###########################################################################
|
||||
unless ($user->in_group('editcomponents')) {
|
||||
check_votes_or_keywords('keywords');
|
||||
Status('checks_completed');
|
||||
|
||||
$template->process('global/footer.html.tmpl', $vars)
|
||||
|
@ -691,27 +686,19 @@ sub check_votes_or_keywords {
|
|||
my $check = shift || 'all';
|
||||
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $sth = $dbh->prepare(q{SELECT bug_id, votes, keywords
|
||||
my $sth = $dbh->prepare(q{SELECT bug_id, votes
|
||||
FROM bugs
|
||||
WHERE votes != 0 OR keywords != ''});
|
||||
WHERE votes != 0});
|
||||
$sth->execute;
|
||||
|
||||
my %votes;
|
||||
my %keyword;
|
||||
|
||||
while (my ($id, $v, $k) = $sth->fetchrow_array) {
|
||||
if ($v != 0) {
|
||||
$votes{$id} = $v;
|
||||
}
|
||||
if ($k) {
|
||||
$keyword{$id} = $k;
|
||||
}
|
||||
$votes{$id} = $v;
|
||||
}
|
||||
|
||||
# If we only want to check keywords, skip checks about votes.
|
||||
_check_votes(\%votes) unless ($check eq 'keywords');
|
||||
# If we only want to check votes, skip checks about keywords.
|
||||
_check_keywords(\%keyword) unless ($check eq 'votes');
|
||||
_check_votes(\%votes);
|
||||
}
|
||||
|
||||
sub _check_votes {
|
||||
|
@ -745,119 +732,6 @@ sub _check_votes {
|
|||
Status('vote_cache_rebuild_fix') if $offer_votecache_rebuild;
|
||||
}
|
||||
|
||||
sub _check_keywords {
|
||||
my $keyword = shift;
|
||||
|
||||
Status('keyword_check_start');
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $cgi = Bugzilla->cgi;
|
||||
|
||||
my %keywordids;
|
||||
my $keywords = $dbh->selectall_arrayref(q{SELECT id, name
|
||||
FROM keyworddefs});
|
||||
|
||||
foreach (@$keywords) {
|
||||
my ($id, $name) = @$_;
|
||||
if ($keywordids{$id}) {
|
||||
Status('keyword_check_alert', {id => $id}, 'alert');
|
||||
}
|
||||
$keywordids{$id} = 1;
|
||||
if ($name =~ /[\s,]/) {
|
||||
Status('keyword_check_invalid_name', {id => $id}, 'alert');
|
||||
}
|
||||
}
|
||||
|
||||
my $sth = $dbh->prepare(q{SELECT bug_id, keywordid
|
||||
FROM keywords
|
||||
ORDER BY bug_id, keywordid});
|
||||
$sth->execute;
|
||||
my $lastid;
|
||||
my $lastk;
|
||||
while (my ($id, $k) = $sth->fetchrow_array) {
|
||||
if (!$keywordids{$k}) {
|
||||
Status('keyword_check_invalid_id', {id => $k}, 'alert');
|
||||
}
|
||||
if (defined $lastid && $id eq $lastid && $k eq $lastk) {
|
||||
Status('keyword_check_duplicated_ids', {id => $id}, 'alert');
|
||||
}
|
||||
$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();
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# Check for flags being in incorrect products and components
|
||||
###########################################################################
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
[%# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
||||
# Vlad Dascalu <jocuri@softhome.net>
|
||||
#%]
|
||||
|
||||
[%# INTERFACE:
|
||||
# none
|
||||
#%]
|
||||
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = "Add keyword"
|
||||
subheader = "This page allows you to add a new keyword."
|
||||
%]
|
||||
|
||||
<form method="post" action="editkeywords.cgi">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<th align="right">Name:</th>
|
||||
<td><input size="64" maxlength="64" name="name" value=""></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="right">Description:</th>
|
||||
<td>
|
||||
[% INCLUDE global/textarea.html.tmpl
|
||||
name = 'description'
|
||||
minrows = 4
|
||||
cols = 64
|
||||
wrap = 'virtual'
|
||||
%]
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<input type="hidden" name="id" value="-1">
|
||||
<input type="submit" id="create" value="Add">
|
||||
<input type="hidden" name="action" value="new">
|
||||
<input type="hidden" name="token" value="[% token FILTER html %]">
|
||||
</form>
|
||||
|
||||
<p><a href="editkeywords.cgi">Edit other keywords</a>.</p>
|
||||
|
||||
[% PROCESS global/footer.html.tmpl %]
|
|
@ -1,20 +1,4 @@
|
|||
[%# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
[%# License: MPL 2.0, incompatible with secondary licenses
|
||||
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
||||
# Vlad Dascalu <jocuri@softhome.net>
|
||||
# Max Kanat-Alexander <mkanat@bugzilla.org>
|
||||
|
@ -25,15 +9,14 @@
|
|||
#%]
|
||||
|
||||
[% PROCESS global/header.html.tmpl
|
||||
title = "Edit keyword"
|
||||
title = keyword.id ? "Edit keyword" : "Add keyword"
|
||||
%]
|
||||
|
||||
<form method="post" action="editkeywords.cgi">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<th align="right">Name:</th>
|
||||
<td><input size="64" maxlength="64" name="name"
|
||||
value="[% keyword.name FILTER html %]"></td>
|
||||
<td><input size="64" maxlength="64" name="name" value="[% keyword.name | html %]" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th align="right">Description:</th>
|
||||
|
@ -47,23 +30,25 @@
|
|||
%]
|
||||
</td>
|
||||
</tr>
|
||||
[% IF keyword.id %]
|
||||
<tr>
|
||||
<th align="right">[% terms.Bugs %]:</th>
|
||||
<td>
|
||||
[% IF keyword.bug_count > 0 %]
|
||||
<a href="buglist.cgi?keywords=[% keyword.name FILTER url_quote %]">
|
||||
[% keyword.bug_count FILTER html %]</a>
|
||||
<a href="buglist.cgi?keywords=[% keyword.name | url_quote %]">
|
||||
[% keyword.bug_count | html %]</a>
|
||||
[% ELSE %]
|
||||
none
|
||||
[% END %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
</table>
|
||||
|
||||
<input type="submit" id="update" value="Save Changes">
|
||||
<input type="hidden" name="action" value="update">
|
||||
<input type="hidden" name="id" value="[% keyword.id FILTER html %]">
|
||||
<input type="hidden" name="token" value="[% token FILTER html %]">
|
||||
<input type="submit" value="[% keyword.id ? "Save Changes" : "Add" %]">
|
||||
<input type="hidden" name="action" value="[% keyword.id ? "update" : "new" %]">
|
||||
<input type="hidden" name="id" value="[% keyword.id || -1 | html %]">
|
||||
<input type="hidden" name="token" value="[% token | html %]">
|
||||
</form>
|
||||
|
||||
<p><a href="editkeywords.cgi">Edit other keywords</a>.</p>
|
||||
|
|
|
@ -226,23 +226,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.
|
||||
|
||||
|
|
|
@ -513,10 +513,6 @@
|
|||
[% BLOCK msg_keyword_deleted %]
|
||||
[% title = "Keyword Deleted" %]
|
||||
The <em>[% keyword.name | 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).
|
||||
[% END %]
|
||||
|
||||
[% BLOCK msg_keyword_updated %]
|
||||
|
@ -526,13 +522,7 @@
|
|||
been saved:
|
||||
<ul>
|
||||
[% IF changes.name.defined %]
|
||||
<li>
|
||||
Keyword renamed to <em>[% keyword.name | 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 | html %]</em>.</li>
|
||||
[% END %]
|
||||
[% IF changes.description.defined %]
|
||||
<li>Description updated to <em>[% keyword.description | html %]</em></li>
|
||||
|
|
Loading…
Reference in New Issue