From 496a78f616b10c1c5c4bd0398021232e9bffa77e Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Sat, 18 Nov 2006 23:10:11 +0000 Subject: Bug 304550: Bugzilla should always store data in MySQL as UTF-8 Patch By Max Kanat-Alexander r=LpSolit, a=justdave --- Bugzilla/Config/Common.pm | 14 +++++++++++++- Bugzilla/Config/Core.pm | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Config') diff --git a/Bugzilla/Config/Common.pm b/Bugzilla/Config/Common.pm index 8b94220f8..a609936c0 100644 --- a/Bugzilla/Config/Common.pm +++ b/Bugzilla/Config/Common.pm @@ -48,7 +48,7 @@ use base qw(Exporter); check_opsys check_shadowdb check_urlbase check_webdotbase check_netmask check_user_verify_class check_image_converter check_languages check_mail_delivery_method check_notification - check_timezone + check_timezone check_utf8 ); # Checking functions for the various values @@ -114,6 +114,18 @@ sub check_sslbase { return ""; } +sub check_utf8 { + my $utf8 = shift; + # You cannot turn off the UTF-8 parameter if you've already converted + # your tables to utf-8. + my $dbh = Bugzilla->dbh; + if ($dbh->isa('Bugzilla::DB::Mysql') && $dbh->bz_db_is_utf8 && !$utf8) { + return "You cannot disable UTF-8 support, because your MySQL database" + . " is encoded in UTF-8"; + } + return ""; +} + sub check_priority { my ($value) = (@_); my $legal_priorities = get_legal_field_values('priority'); diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm index 5688e5c8c..33eb46ac5 100644 --- a/Bugzilla/Config/Core.pm +++ b/Bugzilla/Config/Core.pm @@ -98,6 +98,7 @@ sub get_param_list { name => 'utf8', type => 'b', default => '0', + checker => \&check_utf8 }, { -- cgit v1.2.3-24-g4f1b