Commit 0270a421 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Imported Bugzilla 3.1.4.

parent 291200cb
......@@ -47,6 +47,7 @@ use Bugzilla::User;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::Field;
use Bugzilla::Flag;
use File::Basename;
use File::Spec::Functions;
......@@ -430,10 +431,22 @@ sub get_fields {
return @$fields;
}
sub custom_field_names {
# Get a list of custom fields and convert it into a list of their names.
return map($_->{name},
@{Bugzilla::Field->match({ custom=>1, obsolete=>0 })});
sub active_custom_fields {
my $class = shift;
if (!exists $class->request_cache->{active_custom_fields}) {
$class->request_cache->{active_custom_fields} =
Bugzilla::Field->match({ custom => 1, obsolete => 0 });
}
return @{$class->request_cache->{active_custom_fields}};
}
sub has_flags {
my $class = shift;
if (!defined $class->request_cache->{has_flags}) {
$class->request_cache->{has_flags} = Bugzilla::Flag::has_flags();
}
return $class->request_cache->{has_flags};
}
sub hook_args {
......
......@@ -426,7 +426,7 @@ sub flags {
my $self = shift;
return $self->{flags} if exists $self->{flags};
$self->{flags} = Bugzilla::Flag::match({ 'attach_id' => $self->id });
$self->{flags} = Bugzilla::Flag->match({ 'attach_id' => $self->id });
return $self->{flags};
}
......@@ -890,7 +890,7 @@ sub insert_attachment_for_bug {
foreach my $obsolete_attachment (@obsolete_attachments) {
# If the obsolete attachment has request flags, cancel them.
# This call must be done before updating the 'attachments' table.
Bugzilla::Flag::CancelRequests($bug, $obsolete_attachment, $timestamp);
Bugzilla::Flag->CancelRequests($bug, $obsolete_attachment, $timestamp);
$dbh->do('UPDATE attachments SET isobsolete = 1, modification_time = ?
WHERE attach_id = ?',
......@@ -917,8 +917,8 @@ sub insert_attachment_for_bug {
my $error_mode_cache = Bugzilla->error_mode;
Bugzilla->error_mode(ERROR_MODE_DIE);
eval {
Bugzilla::Flag::validate($cgi, $bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag::process($bug, $attachment, $timestamp, $cgi, $hr_vars);
Bugzilla::Flag::validate($bug->bug_id, -1, SKIP_REQUESTEE_ON_ERROR);
Bugzilla::Flag->process($bug, $attachment, $timestamp, $hr_vars);
};
Bugzilla->error_mode($error_mode_cache);
if ($@) {
......
/PatchReader.pm/1.4/Sat Dec 30 01:58:28 2006//TBUGZILLA-3_1_3
/PatchReader.pm/1.5/Thu Apr 3 16:58:29 2008//TBUGZILLA-3_1_4
D
......@@ -21,7 +21,9 @@ package Bugzilla::Attachment::PatchReader;
use Bugzilla::Error;
use Bugzilla::Attachment;
use Bugzilla::Util;
use Encode;
sub process_diff {
my ($attachment, $format, $context) = @_;
......@@ -38,7 +40,7 @@ sub process_diff {
# Actually print out the patch.
print $cgi->header(-type => 'text/plain',
-expires => '+3M');
disable_utf8();
$reader->iterate_string('Attachment ' . $attachment->id, $attachment->data);
}
else {
......@@ -74,7 +76,12 @@ sub process_diff {
$vars->{'other_patches'} = \@other_patches;
setup_template_patch_reader($last_reader, $format, $context, $vars);
# Actually print out the patch.
# The patch is going to be displayed in a HTML page and if the utf8
# param is enabled, we have to encode attachment data as utf8.
# Encode::decode() knows what to do with invalid characters.
if (Bugzilla->params->{'utf8'}) {
$attachment->{data} = Encode::decode_utf8($attachment->data);
}
$reader->iterate_string('Attachment ' . $attachment->id, $attachment->data);
}
}
......@@ -85,10 +92,18 @@ sub process_interdiff {
my $lc = Bugzilla->localconfig;
my $vars = {};
# Encode attachment data as utf8 if it's going to be displayed in a HTML
# page using the UTF-8 encoding.
# Encode::decode() knows what to do with invalid characters.
if ($format ne 'raw' && Bugzilla->params->{'utf8'}) {
$old_attachment->{data} = Encode::decode_utf8($old_attachment->data);
$new_attachment->{data} = Encode::decode_utf8($new_attachment->data);
}
# Get old patch data.
my ($old_filename, $old_file_list) = get_unified_diff($old_attachment);
my ($old_filename, $old_file_list) = get_unified_diff($old_attachment, $format);
# Get new patch data.
my ($new_filename, $new_file_list) = get_unified_diff($new_attachment);
my ($new_filename, $new_file_list) = get_unified_diff($new_attachment, $format);
my $warning = warn_if_interdiff_might_fail($old_file_list, $new_file_list);
......@@ -105,8 +120,12 @@ sub process_interdiff {
# Actually print out the patch.
print $cgi->header(-type => 'text/plain',
-expires => '+3M');
disable_utf8();
}
else {
# In case the HTML page is displayed with the UTF-8 encoding.
binmode $interdiff_fh, ':utf8' if Bugzilla->params->{'utf8'};
$vars->{'warning'} = $warning if $warning;
$vars->{'bugid'} = $new_attachment->bug_id;
$vars->{'oldid'} = $old_attachment->id;
......@@ -131,7 +150,7 @@ sub process_interdiff {
######################
sub get_unified_diff {
my $attachment = shift;
my ($attachment, $format) = @_;
# Bring in the modules we need.
require PatchReader::Raw;
......@@ -162,6 +181,10 @@ sub get_unified_diff {
# Prints out to temporary file.
my ($fh, $filename) = File::Temp::tempfile();
if ($format ne 'raw' && Bugzilla->params->{'utf8'}) {
# The HTML page will be displayed with the UTF-8 encoding.
binmode $fh, ':utf8';
}
my $raw_printer = new PatchReader::DiffPrinter::raw($fh);
$last_reader->sends_data_to($raw_printer);
$last_reader = $raw_printer;
......@@ -245,7 +268,7 @@ sub setup_template_patch_reader {
$vars->{'headers'} = $cgi->param('headers');
}
else {
$vars->{'headers'} = 1 if !defined $cgi->param('headers');
$vars->{'headers'} = 1;
}
$vars->{'collapsed'} = $cgi->param('collapsed');
......
/Login.pm/1.1/Fri May 12 02:41:05 2006//TBUGZILLA-3_1_3
/Verify.pm/1.7/Wed May 23 18:05:49 2007//TBUGZILLA-3_1_3
/Login.pm/1.1/Fri May 12 02:41:05 2006//TBUGZILLA-3_1_4
/Verify.pm/1.7/Wed May 23 18:05:49 2007//TBUGZILLA-3_1_4
D/Login////
D/Persist////
D/Verify////
NBUGZILLA-3_1_3
NBUGZILLA-3_1_4
/CGI.pm/1.8/Wed Nov 14 22:50:25 2007//TBUGZILLA-3_1_3
/Cookie.pm/1.5/Wed Jul 5 23:42:47 2006//TBUGZILLA-3_1_3
/Env.pm/1.4/Mon Jul 3 21:42:46 2006//TBUGZILLA-3_1_3
/Stack.pm/1.1/Fri May 12 02:41:06 2006//TBUGZILLA-3_1_3
/CGI.pm/1.8/Wed Nov 14 22:50:25 2007//TBUGZILLA-3_1_4
/Cookie.pm/1.5/Wed Jul 5 23:42:47 2006//TBUGZILLA-3_1_4
/Env.pm/1.4/Mon Jul 3 21:42:46 2006//TBUGZILLA-3_1_4
/Stack.pm/1.1/Fri May 12 02:41:06 2006//TBUGZILLA-3_1_4
D
/Cookie.pm/1.5/Mon Jul 3 21:42:46 2006//TBUGZILLA-3_1_3
/Cookie.pm/1.5/Mon Jul 3 21:42:46 2006//TBUGZILLA-3_1_4
D
/DB.pm/1.7/Fri May 12 02:41:14 2006//TBUGZILLA-3_1_3
/LDAP.pm/1.17/Fri Dec 14 18:17:29 2007//TBUGZILLA-3_1_3
/RADIUS.pm/1.1/Thu Aug 2 22:38:37 2007//TBUGZILLA-3_1_3
/Stack.pm/1.1/Fri May 12 02:41:14 2006//TBUGZILLA-3_1_3
/DB.pm/1.7/Fri May 12 02:41:14 2006//TBUGZILLA-3_1_4
/LDAP.pm/1.17/Fri Dec 14 18:17:29 2007//TBUGZILLA-3_1_4
/RADIUS.pm/1.1/Thu Aug 2 22:38:37 2007//TBUGZILLA-3_1_4
/Stack.pm/1.1/Fri May 12 02:41:14 2006//TBUGZILLA-3_1_4
D
This diff is collapsed.
......@@ -86,7 +86,11 @@ sub multiline_sprintf {
# Make any single undef item into ''
@line = map { defined $_ ? $_ : '' } @line;
# And append a formatted line
$formatted .= sprintf("$format\n", @line);
$formatted .= sprintf($format, @line);
# Remove trailing spaces, or they become lots of =20's in
# quoted-printable emails.
$formatted =~ s/\s+$//;
$formatted .= "\n";
}
return $formatted;
}
......@@ -601,7 +605,7 @@ sub sendMail {
}
}
if ($difftext eq "" && $newcomments eq "") {
if ($difftext eq "" && $newcomments eq "" && !$isnew) {
# Whoops, no differences!
return 0;
}
......@@ -645,7 +649,8 @@ sub sendMail {
$threadingmarker = "Message-ID: <bug-$id-" . $user->id . "$sitespec>";
}
else {
$threadingmarker = "In-Reply-To: <bug-$id-" . $user->id . "$sitespec>";
$threadingmarker = "In-Reply-To: <bug-$id-" . $user->id . "$sitespec>" .
"\nReferences: <bug-$id-" . $user->id . "$sitespec>";
}
......
/.cvsignore/1.1/Mon Aug 26 22:24:55 2002//TBUGZILLA-3_1_3
/Attachment.pm/1.54/Sun Jan 20 15:03:58 2008//TBUGZILLA-3_1_3
/Auth.pm/1.20/Wed Jul 12 11:51:43 2006//TBUGZILLA-3_1_3
/Bug.pm/1.230/Sun Jan 20 22:18:56 2008//TBUGZILLA-3_1_3
/BugMail.pm/1.115/Sun Jan 27 19:39:28 2008//TBUGZILLA-3_1_3
/CGI.pm/1.36/Tue Jan 29 19:19:36 2008//TBUGZILLA-3_1_3
/Chart.pm/1.16/Fri Oct 19 06:46:14 2007//TBUGZILLA-3_1_3
/Classification.pm/1.11/Tue Dec 19 08:38:49 2006//TBUGZILLA-3_1_3
/Component.pm/1.16/Thu Oct 11 23:07:22 2007//TBUGZILLA-3_1_3
/Config.pm/1.73/Fri Jan 18 05:04:19 2008//TBUGZILLA-3_1_3
/Constants.pm/1.89/Sat Feb 2 00:34:19 2008//TBUGZILLA-3_1_3
/DB.pm/1.109/Sun Jan 27 19:15:19 2008//TBUGZILLA-3_1_3
/Error.pm/1.23/Sun Jan 27 19:15:19 2008//TBUGZILLA-3_1_3
/Field.pm/1.29/Tue Oct 23 19:36:51 2007//TBUGZILLA-3_1_3
/Flag.pm/1.89/Sun Jan 20 22:12:50 2008//TBUGZILLA-3_1_3
/FlagType.pm/1.38/Wed Jul 4 21:05:58 2007//TBUGZILLA-3_1_3
/Group.pm/1.22/Tue Sep 18 23:36:59 2007//TBUGZILLA-3_1_3
/Hook.pm/1.13/Fri Oct 19 08:07:28 2007//TBUGZILLA-3_1_3
/Install.pm/1.17/Wed Nov 28 16:35:57 2007//TBUGZILLA-3_1_3
/Keyword.pm/1.7/Tue Sep 5 19:18:26 2006//TBUGZILLA-3_1_3
/Mailer.pm/1.17/Sun Jan 27 18:08:45 2008//TBUGZILLA-3_1_3
/Milestone.pm/1.12/Fri Jan 18 15:56:54 2008//TBUGZILLA-3_1_3
/Object.pm/1.22/Fri Jan 18 15:56:54 2008//TBUGZILLA-3_1_3
/Product.pm/1.25/Sat Jan 12 16:23:12 2008//TBUGZILLA-3_1_3
/Search.pm/1.152/Tue Jan 29 01:47:01 2008//TBUGZILLA-3_1_3
/Series.pm/1.16/Sun Nov 18 20:20:53 2007//TBUGZILLA-3_1_3
/Status.pm/1.6/Thu Jan 17 20:41:44 2008//TBUGZILLA-3_1_3
/Template.pm/1.85/Sat Dec 15 03:17:53 2007//TBUGZILLA-3_1_3
/Token.pm/1.54/Sun Nov 18 20:20:53 2007//TBUGZILLA-3_1_3
/Update.pm/1.9/Wed Jan 30 01:55:16 2008//TBUGZILLA-3_1_3
/User.pm/1.164/Sun Jan 20 02:22:26 2008//TBUGZILLA-3_1_3
/Util.pm/1.67/Thu Dec 27 22:39:27 2007//TBUGZILLA-3_1_3
/Version.pm/1.14/Thu Aug 23 21:31:20 2007//TBUGZILLA-3_1_3
/WebService.pm/1.6/Mon Mar 26 07:52:17 2007//TBUGZILLA-3_1_3
/.cvsignore/1.1/Mon Aug 26 22:24:55 2002//TBUGZILLA-3_1_4
/Attachment.pm/1.56/Mon Feb 4 13:29:29 2008//TBUGZILLA-3_1_4
/Auth.pm/1.20/Wed Jul 12 11:51:43 2006//TBUGZILLA-3_1_4
/Bug.pm/1.241/Fri May 2 07:36:27 2008//TBUGZILLA-3_1_4
/BugMail.pm/1.118/Tue Feb 12 21:13:07 2008//TBUGZILLA-3_1_4
/CGI.pm/1.36/Tue Jan 29 19:19:36 2008//TBUGZILLA-3_1_4
/Chart.pm/1.16/Fri Oct 19 06:46:14 2007//TBUGZILLA-3_1_4
/Classification.pm/1.11/Tue Dec 19 08:38:49 2006//TBUGZILLA-3_1_4
/Component.pm/1.16/Thu Oct 11 23:07:22 2007//TBUGZILLA-3_1_4
/Config.pm/1.73/Fri Jan 18 05:04:19 2008//TBUGZILLA-3_1_4
/Constants.pm/1.91/Mon May 5 01:52:43 2008//TBUGZILLA-3_1_4
/DB.pm/1.112/Sun Apr 20 09:49:56 2008//TBUGZILLA-3_1_4
/Error.pm/1.23/Sun Jan 27 19:15:19 2008//TBUGZILLA-3_1_4
/Field.pm/1.31/Mon Feb 25 16:06:25 2008//TBUGZILLA-3_1_4
/Flag.pm/1.94/Wed Apr 2 17:42:27 2008//TBUGZILLA-3_1_4
/FlagType.pm/1.38/Wed Jul 4 21:05:58 2007//TBUGZILLA-3_1_4
/Group.pm/1.22/Tue Sep 18 23:36:59 2007//TBUGZILLA-3_1_4
/Hook.pm/1.13/Fri Oct 19 08:07:28 2007//TBUGZILLA-3_1_4
/Install.pm/1.17/Wed Nov 28 16:35:57 2007//TBUGZILLA-3_1_4
/Keyword.pm/1.7/Tue Sep 5 19:18:26 2006//TBUGZILLA-3_1_4
/Mailer.pm/1.20/Wed Apr 9 14:27:32 2008//TBUGZILLA-3_1_4
/Milestone.pm/1.12/Fri Jan 18 15:56:54 2008//TBUGZILLA-3_1_4
/Object.pm/1.23/Thu Mar 27 05:08:08 2008//TBUGZILLA-3_1_4
/Product.pm/1.26/Thu Mar 27 05:08:08 2008//TBUGZILLA-3_1_4
/Search.pm/1.159/Thu Mar 27 13:48:27 2008//TBUGZILLA-3_1_4
/Series.pm/1.16/Sun Nov 18 20:20:53 2007//TBUGZILLA-3_1_4
/Status.pm/1.7/Tue Feb 12 01:32:51 2008//TBUGZILLA-3_1_4
/Template.pm/1.89/Thu Apr 3 19:05:36 2008//TBUGZILLA-3_1_4
/Token.pm/1.55/Wed Apr 2 17:42:27 2008//TBUGZILLA-3_1_4
/Update.pm/1.10/Fri May 2 19:14:13 2008//TBUGZILLA-3_1_4
/User.pm/1.164/Sun Jan 20 02:22:26 2008//TBUGZILLA-3_1_4
/Util.pm/1.69/Thu Apr 3 16:58:29 2008//TBUGZILLA-3_1_4
/Version.pm/1.14/Thu Aug 23 21:31:20 2007//TBUGZILLA-3_1_4
/WebService.pm/1.9/Mon Apr 28 22:04:31 2008//TBUGZILLA-3_1_4
D/Attachment////
D/Auth////
D/Config////
......
NBUGZILLA-3_1_3
NBUGZILLA-3_1_4
/Admin.pm/1.2/Thu Oct 13 09:04:04 2005//TBUGZILLA-3_1_3
/Attachment.pm/1.3/Mon Apr 17 20:19:35 2006//TBUGZILLA-3_1_3
/Auth.pm/1.3/Thu Aug 2 22:38:39 2007//TBUGZILLA-3_1_3
/BugChange.pm/1.5/Tue Oct 9 10:34:54 2007//TBUGZILLA-3_1_3
/BugFields.pm/1.5/Mon Sep 10 22:57:00 2007//TBUGZILLA-3_1_3
/BugMove.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_3
/Common.pm/1.19/Tue Oct 9 10:34:54 2007//TBUGZILLA-3_1_3
/Core.pm/1.8/Wed Apr 18 00:13:22 2007//TBUGZILLA-3_1_3
/DependencyGraph.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_3
/GroupSecurity.pm/1.8/Mon Aug 7 23:05:00 2006//TBUGZILLA-3_1_3
/LDAP.pm/1.2/Fri Jun 2 11:52:48 2006//TBUGZILLA-3_1_3
/MTA.pm/1.15/Sun Jun 17 18:57:10 2007//TBUGZILLA-3_1_3
/PatchViewer.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_3
/Query.pm/1.5/Tue Jul 3 16:22:01 2007//TBUGZILLA-3_1_3
/RADIUS.pm/1.1/Thu Aug 2 22:38:39 2007//TBUGZILLA-3_1_3
/ShadowDB.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_3
/UserMatch.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_3
/Admin.pm/1.2/Thu Oct 13 09:04:04 2005//TBUGZILLA-3_1_4
/Attachment.pm/1.3/Mon Apr 17 20:19:35 2006//TBUGZILLA-3_1_4
/Auth.pm/1.3/Thu Aug 2 22:38:39 2007//TBUGZILLA-3_1_4
/BugChange.pm/1.5/Tue Oct 9 10:34:54 2007//TBUGZILLA-3_1_4
/BugFields.pm/1.5/Mon Sep 10 22:57:00 2007//TBUGZILLA-3_1_4
/BugMove.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_4
/Common.pm/1.21/Thu Mar 27 00:23:41 2008//TBUGZILLA-3_1_4
/Core.pm/1.9/Thu Apr 3 19:05:37 2008//TBUGZILLA-3_1_4
/DependencyGraph.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_4
/GroupSecurity.pm/1.8/Mon Aug 7 23:05:00 2006//TBUGZILLA-3_1_4
/LDAP.pm/1.2/Fri Jun 2 11:52:48 2006//TBUGZILLA-3_1_4
/MTA.pm/1.16/Fri Mar 14 00:05:35 2008//TBUGZILLA-3_1_4
/PatchViewer.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_4
/Query.pm/1.5/Tue Jul 3 16:22:01 2007//TBUGZILLA-3_1_4
/RADIUS.pm/1.1/Thu Aug 2 22:38:39 2007//TBUGZILLA-3_1_4
/ShadowDB.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_4
/UserMatch.pm/1.1/Wed Oct 12 08:51:53 2005//TBUGZILLA-3_1_4
D
NBUGZILLA-3_1_3
NBUGZILLA-3_1_4
......@@ -50,7 +50,7 @@ use base qw(Exporter);
check_opsys check_shadowdb check_urlbase check_webdotbase
check_netmask check_user_verify_class check_image_converter
check_mail_delivery_method check_notification check_timezone check_utf8
check_bug_status
check_bug_status check_smtp_auth
);
# Checking functions for the various values
......@@ -101,17 +101,21 @@ sub check_sslbase {
return "must be a legal URL, that starts with https and ends with a slash.";
}
my $host = $1;
if ($host =~ /:\d+$/) {
return "must not contain a port.";
# Fall back to port 443 if for some reason getservbyname() fails.
my $port = getservbyname('https', 'tcp') || 443;
if ($host =~ /^(.+):(\d+)$/) {
$host = $1;
$port = $2;
}
local *SOCK;
my $proto = getprotobyname('tcp');
socket(SOCK, PF_INET, SOCK_STREAM, $proto);
my $sin = sockaddr_in(443, inet_aton($host));
my $iaddr = inet_aton($host) || return "The host $host cannot be resolved";
my $sin = sockaddr_in($port, $iaddr);
if (!connect(SOCK, $sin)) {
return "Failed to connect to " . html_quote($host) .
":443, unable to enable SSL.";
return "Failed to connect to $host:$port; unable to enable SSL";
}
close(SOCK);
}
return "";
}
......@@ -337,6 +341,14 @@ sub check_timezone {
return "";
}
sub check_smtp_auth {
my $username = shift;
if ($username) {
eval "require Authen::SASL";
return "Error requiring Authen::SASL: '$@'" if $@;
}
return "";
}
# OK, here are the parameter definitions themselves.
#
......@@ -354,6 +366,8 @@ sub check_timezone {
# The type value can be one of the following:
#
# t -- A short text entry field (suitable for a single line)
# p -- A short text entry field (as with type = 't'), but the string is
# replaced by asterisks (appropriate for passwords)
# l -- A long text field (suitable for many lines)
# b -- A boolean value (either 1 or 0)
# m -- A list of values, with many selectable (shows up as a select box)
......
......@@ -56,7 +56,7 @@ sub get_param_list {
{
name => 'docs_urlbase',
type => 't',
default => 'docs/html/',
default => 'docs/%lang%/html/',
checker => \&check_url
},
......
......@@ -68,6 +68,17 @@ sub get_param_list {
type => 't',
default => 'localhost'
},
{
name => 'smtp_username',
type => 't',
default => '',
checker => \&check_smtp_auth
},
{
name => 'smtp_password',
type => 'p',
default => ''
},
{
name => 'smtp_debug',
type => 'b',
......
......@@ -156,7 +156,7 @@ use File::Basename;
# CONSTANTS
#
# Bugzilla version
use constant BUGZILLA_VERSION => "3.1.3";
use constant BUGZILLA_VERSION => "3.1.4";
# These are unique values that are unlikely to match a string or a number,
# to be used in criteria for match() functions and other things. They start
......
......@@ -383,26 +383,6 @@ sub bz_last_key {
$table, $column);
}
sub bz_get_field_defs {
my ($self) = @_;
my $extra = "";
if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) {
$extra = "AND name NOT IN ('estimated_time', 'remaining_time', " .
"'work_time', 'percentage_complete', 'deadline')";
}
my @fields;
my $sth = $self->prepare("SELECT name, description FROM fielddefs
WHERE obsolete = 0 $extra
ORDER BY sortkey");
$sth->execute();
while (my $field_ref = $sth->fetchrow_hashref()) {
push(@fields, $field_ref);
}
return(@fields);
}
#####################################################################
# Database Setup
#####################################################################
......@@ -660,18 +640,23 @@ sub _bz_add_table_raw {
}
sub _bz_add_field_table {
my ($self, $name, $table_schema) = @_;
my ($self, $name, $schema_ref) = @_;
# We do nothing if the table already exists.
return if $self->bz_table_info($name);
my $indexes = $table_schema->{INDEXES};
# $indexes is an arrayref, not a hash. In order to fix the keys,
# we have to fix every other item.
for (my $i = 0; $i < scalar @$indexes; $i++) {
next if ($i % 2 && $i != 0); # We skip 1, 3, 5, 7, etc.
$indexes->[$i] = $name . "_" . $indexes->[$i];
# Copy this so that we're not modifying the passed reference.
# (This avoids modifying a constant in Bugzilla::DB::Schema.)
my %table_schema = %$schema_ref;
my %indexes = @{ $table_schema{INDEXES} };
my %fixed_indexes;
foreach my $key (keys %indexes) {
$fixed_indexes{$name . "_" . $key} = $indexes{$key};
}
# INDEXES is supposed to be an arrayref, so we have to convert back.
my @indexes_array = %fixed_indexes;
$table_schema{INDEXES} = \@indexes_array;
# We add this to the abstract schema so that bz_add_table can find it.
$self->_bz_schema->add_table($name, $table_schema);
$self->_bz_schema->add_table($name, \%table_schema);
$self->bz_add_table($name);
}
......@@ -687,6 +672,13 @@ sub bz_add_field_tables {
}
sub bz_drop_field_tables {
my ($self, $field) = @_;
if ($field->type == FIELD_TYPE_MULTI_SELECT) {
$self->bz_drop_table('bug_' . $field->name);
}
$self->bz_drop_table($field->name);
}
sub bz_drop_column {
my ($self, $table, $column) = @_;
......@@ -1261,9 +1253,6 @@ Bugzilla::DB - Database access routines, using L<DBI>
my $column = $dbh->bz_column_info($table, $column);
my $index = $dbh->bz_index_info($table, $index);
# General Information
my @fields = $dbh->bz_get_field_defs();
=head1 DESCRIPTION
Functions in this module allows creation of a database handle to connect
......@@ -1937,23 +1926,6 @@ Last inserted ID (scalar)
=back
=item C<bz_get_field_defs>
=over
=item B<Description>
Returns a list of all the "bug" fields in Bugzilla. The list
contains hashes, with a C<name> key and a C<description> key.
=item B<Params> (none)
=item B<Returns>
List of all the "bug" fields
=back
=back
=head2 Database Setup Methods
......
/Mysql.pm/1.56/Sun Jan 27 19:15:21 2008//TBUGZILLA-3_1_3
/Oracle.pm/1.6/Fri Jan 18 19:57:20 2008//TBUGZILLA-3_1_3
/Pg.pm/1.26/Tue Dec 11 05:36:05 2007//TBUGZILLA-3_1_3
/Schema.pm/1.97/Wed Jan 9 15:14:02 2008//TBUGZILLA-3_1_3
/Mysql.pm/1.60/Tue Mar 25 18:43:20 2008//TBUGZILLA-3_1_4
/Oracle.pm/1.6/Fri Jan 18 19:57:20 2008//TBUGZILLA-3_1_4
/Pg.pm/1.27/Mon Mar 24 22:47:24 2008//TBUGZILLA-3_1_4
/Schema.pm/1.98/Mon Mar 24 22:47:24 2008//TBUGZILLA-3_1_4
D/Schema////
NBUGZILLA-3_1_3
NBUGZILLA-3_1_4
......@@ -255,11 +255,11 @@ EOT
print "\nISAM->MyISAM table conversion done.\n\n";
}
my $sd_index_deleted = 0;
my ($sd_index_deleted, $longdescs_index_deleted);
my @tables = $self->bz_table_list_real();
# We want to convert the bugs table to MyISAM, but it's possible that
# it has a fulltext index on it and this will fail unless we remove
# the index.
# We want to convert tables to InnoDB, but it's possible that they have
# fulltext indexes on them, and conversion will fail unless we remove
# the indexes.
if (grep($_ eq 'bugs', @tables)) {
if ($self->bz_index_info_real('bugs', 'short_desc')) {