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
cef81246
Commit
cef81246
authored
May 31, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 569302: Make sure that Install::DB functions always print out a message
if they are conditionally doing something to the database. r=mkanat, a=mkanat (module owner)
parent
5b260d69
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
9 deletions
+20
-9
DB.pm
Bugzilla/Install/DB.pm
+20
-9
No files found.
Bugzilla/Install/DB.pm
View file @
cef81246
...
...
@@ -1032,6 +1032,7 @@ sub _copy_from_comments_to_longdescs {
# 2000-11-27 For Bugzilla 2.5 and later. Copy data from 'comments' to
# 'longdescs' - the new name of the comments table.
if
(
$dbh
->
bz_table_info
(
'comments'
))
{
print
"Copying data from 'comments' to 'longdescs'...\n"
;
my
$quoted_when
=
$dbh
->
quote_identifier
(
'when'
);
$dbh
->
do
(
"INSERT INTO longdescs (bug_when, bug_id, who, thetext)
SELECT $quoted_when, bug_id, who, comment
...
...
@@ -1239,6 +1240,7 @@ sub _use_ip_instead_of_hostname_in_logincookies {
#
# Use the ip, not the hostname, in the logincookies table
if
(
$dbh
->
bz_column_info
(
"logincookies"
,
"hostname"
))
{
print
"Clearing the logincookies table...\n"
;
# We've changed what we match against, so all entries are now invalid
$dbh
->
do
(
"DELETE FROM logincookies"
);
...
...
@@ -1978,9 +1980,11 @@ sub _copy_old_charts_into_database {
my
$all_name
=
"-All-"
;
my
$open_name
=
"All Open"
;
$dbh
->
bz_start_transaction
();
my
$products
=
$dbh
->
selectall_arrayref
(
"SELECT name FROM products"
);
foreach
my
$product
((
map
{
$_
->
[
0
]
}
@$products
),
"-All-"
)
{
print
"$product:\n"
;
# First, create the series
my
%
queries
;
my
%
seriesids
;
...
...
@@ -2029,8 +2033,9 @@ sub _copy_old_charts_into_database {
my
%
data
;
my
$last_date
=
""
;
while
(
<
$in
>
)
{
if
(
/^(\d+\|.*)/
)
{
my
@lines
=
<
$in
>
;
while
(
my
$line
=
shift
@lines
)
{
if
(
$line
=~
/^(\d+\|.*)/
)
{
my
@numbers
=
split
(
/\||\r/
,
$1
);
# Only take the first line for each date; it was possible to
...
...
@@ -2053,6 +2058,9 @@ sub _copy_old_charts_into_database {
$in
->
close
;
my
$total_items
=
(
scalar
(
@fields
)
+
1
)
*
scalar
(
keys
%
{
$data
{
'NEW'
}
});
my
$count
=
0
;
foreach
my
$field
(
@fields
,
$open_name
)
{
# Insert values into series_data: series_id, date, value
my
%
fielddata
=
%
{
$data
{
$field
}};
...
...
@@ -2064,6 +2072,8 @@ sub _copy_old_charts_into_database {
# We prepared this above
$seriesdatasth
->
execute
(
$seriesids
{
$field
},
$date
,
$fielddata
{
$date
}
||
0
);
indicate_progress
({
total
=>
$total_items
,
current
=>
++
$count
,
every
=>
100
});
}
}
...
...
@@ -2090,6 +2100,8 @@ sub _copy_old_charts_into_database {
}
}
}
$dbh
->
bz_commit_transaction
();
}
}
...
...
@@ -2158,7 +2170,7 @@ sub _convert_attachments_filename_from_mediumtext {
# and attachment.cgi now takes them out, but old ones need converting.
my
$ref
=
$dbh
->
bz_column_info
(
"attachments"
,
"filename"
);
if
(
$ref
->
{
TYPE
}
ne
'varchar(100)'
)
{
print
"Removing paths from filenames in attachments table...
\n
"
;
print
"Removing paths from filenames in attachments table..."
;
my
$sth
=
$dbh
->
prepare
(
"SELECT attach_id, filename FROM attachments "
.
"WHERE "
.
$dbh
->
sql_position
(
q{'/'}
,
'filename'
)
.
" > 0 OR "
.
...
...
@@ -2174,8 +2186,6 @@ sub _convert_attachments_filename_from_mediumtext {
print
"Done.\n"
;
print
"Resizing attachments.filename from mediumtext to"
,
" varchar(100).\n"
;
$dbh
->
bz_alter_column
(
"attachments"
,
"filename"
,
{
TYPE
=>
'varchar(100)'
,
NOTNULL
=>
1
});
}
...
...
@@ -3150,16 +3160,17 @@ sub _populate_bugs_fulltext {
$bug_ids
||=
$dbh
->
selectcol_arrayref
(
'SELECT bug_id FROM bugs'
);
# If there are no bugs in the bugs table, there's nothing to populate.
return
if
!
@$bug_ids
;
my
$num_bugs
=
scalar
@$bug_ids
;
my
$where
=
""
;
if
(
$fulltext
)
{
print
"Updating bugs_fulltext...\n"
;
print
"Updating bugs_fulltext
for $num_bugs bugs
...\n"
;
$where
=
"WHERE "
.
$dbh
->
sql_in
(
'bugs.bug_id'
,
$bug_ids
);
$dbh
->
do
(
"DELETE FROM bugs_fulltext WHERE "
.
$dbh
->
sql_in
(
'bug_id'
,
$bug_ids
));
}
else
{
print
"Populating bugs_fulltext..."
;
print
"Populating bugs_fulltext
with $num_bugs entries
..."
;
print
" (this can take a long time.)\n"
;
}
my
$newline
=
$dbh
->
quote
(
"\n"
);
...
...
@@ -3244,9 +3255,9 @@ sub _fix_invalid_custom_field_names {
next
if
$field
->
name
=~
/^[a-zA-Z0-9_]+$/
;
# The field name is illegal and can break the DB. Kill the field!
$field
->
set_obsolete
(
1
);
eval
{
$field
->
remove_from_db
();
};
print
"Removing custom field '"
.
$field
->
name
.
"' (illegal name)... "
;
print
$@
?
"failed\n$@\n"
:
"succeeded\n"
;
eval
{
$field
->
remove_from_db
();
};
print
$@
?
"failed:\n$@\n"
:
"succeeded\n"
;
}
}
...
...
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