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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Ivlev
bugzilla
Commits
80aa5e83
Commit
80aa5e83
authored
Jan 28, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 414012: Include the table id in fields that fail their new max-length check.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=justdave, a=justdave
parent
c87cca60
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
25 deletions
+24
-25
DB.pm
Bugzilla/Install/DB.pm
+21
-22
strings.txt.pl
template/en/default/setup/strings.txt.pl
+3
-3
No files found.
Bugzilla/Install/DB.pm
View file @
80aa5e83
...
...
@@ -516,7 +516,7 @@ sub update_table_definitions {
_make_lang_setting_dynamic
();
# 2007-11-29 xiaoou.wu@oracle.com - Bug 153129
change_text_types
();
_
change_text_types
();
# 2007-09-09 LpSolit@gmail.com - Bug 99215
_fix_attachment_modification_date
();
...
...
@@ -2937,12 +2937,12 @@ sub _fix_attachment_modification_date {
[
qw(modification_time)
]);
}
sub
change_text_types
{
sub
_
change_text_types
{
my
$dbh
=
Bugzilla
->
dbh
;
return
if
$dbh
->
bz_column_info
(
'series'
,
'query'
)
->
{
TYPE
}
eq
'LONGTEXT'
;
_check_content_length
(
'attachments'
,
'mimetype'
,
255
);
_check_content_length
(
'fielddefs'
,
'description'
,
255
);
_check_content_length
(
'attachments'
,
'description'
,
255
);
_check_content_length
(
'attachments'
,
'mimetype'
,
255
,
'attach_id'
);
_check_content_length
(
'fielddefs'
,
'description'
,
255
,
'id'
);
_check_content_length
(
'attachments'
,
'description'
,
255
,
'attach_id'
);
$dbh
->
bz_alter_column
(
'bugs'
,
'bug_file_loc'
,
{
TYPE
=>
'MEDIUMTEXT'
});
...
...
@@ -2968,28 +2968,27 @@ sub change_text_types {
}
sub
_check_content_length
{
my
(
$table_name
,
$field_name
,
$max_length
)
=
@_
;
my
(
$table_name
,
$field_name
,
$max_length
,
$id_field
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$contents
=
$dbh
->
selectcol_arrayref
(
"SELECT $field_name FROM $table_name
WHERE LENGTH($field_name) > ?"
,
undef
,
$max_length
)
;
my
%
contents
=
@
{
$dbh
->
selectcol_arrayref
(
"SELECT $
id_field, $
field_name FROM $table_name
WHERE LENGTH($field_name) > ?"
,
{
Columns
=>
[
1
,
2
]},
$max_length
)
}
;
if
(
@$contents
)
{
my
@trimmed
;
foreach
my
$item
(
@$contents
)
{
if
(
scalar
keys
%
contents
)
{
print
install_string
(
'install_data_too_long'
,
{
column
=>
$field_name
,
id_column
=>
$id_field
,
table
=>
$table_name
,
max_length
=>
$max_length
});
foreach
my
$id
(
keys
%
contents
)
{
my
$string
=
$contents
{
$id
};
# Don't dump the whole string--it could be 16MB.
if
(
length
(
$item
)
>
80
)
{
push
(
@trimmed
,
substr
(
$item
,
0
,
30
)
.
"..."
.
substr
(
$item
,
-
30
)
.
"\n"
);
}
else
{
push
(
@trimmed
,
$item
);
if
(
length
(
$string
)
>
80
)
{
$string
=
substr
(
$string
,
0
,
30
)
.
"..."
.
substr
(
$string
,
-
30
)
.
"\n"
;
}
print
"$id: $string\n"
;
}
print
install_string
(
'install_data_too_long'
,
{
column
=>
$field_name
,
table
=>
$table_name
,
max_length
=>
$max_length
,
data
=>
join
(
"\n"
,
@trimmed
)
});
exit
3
;
}
}
...
...
template/en/default/setup/strings.txt.pl
View file @
80aa5e83
...
...
@@ -46,10 +46,10 @@ with one command, do:
EOT
install_data_too_long
=>
<<
EOT
,
WARNING:
Some
of
the
data
in
the
##table##.##column## column is longer than
its
new
length
limit
of
##max_length## characters. Please fix this data
and
then
re
-
run
checksetup
.
pl:
its
new
length
limit
of
##max_length## characters. The data that needs to be
fixed
is
printed
below
with
the
value
of
the
##id_column## column first and
then
the
value
of
the
##column## column that needs to be fixed:
##data##
EOT
install_module
=>
'Installing ##module## version ##version##...'
,
module_found
=>
"found v##ver##"
,
...
...
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