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
db29480b
Commit
db29480b
authored
Jan 03, 2013
by
Byron Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 817486: fix _sync_fulltext to avoid always updating bugs_fulltext.short_desc
r=LpSolit,a=LpSolit
parent
2441a096
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
24 deletions
+43
-24
Bug.pm
Bugzilla/Bug.pm
+39
-20
Comment.pm
Bugzilla/Comment.pm
+1
-1
Migrate.pm
Bugzilla/Migrate.pm
+1
-1
importxml.pl
importxml.pl
+1
-1
sanitycheck.cgi
sanitycheck.cgi
+1
-1
No files found.
Bugzilla/Bug.pm
View file @
db29480b
...
@@ -731,7 +731,7 @@ sub create {
...
@@ -731,7 +731,7 @@ sub create {
# Because MySQL doesn't support transactions on the fulltext table,
# Because MySQL doesn't support transactions on the fulltext table,
# we do this after we've committed the transaction. That way we're
# we do this after we've committed the transaction. That way we're
# sure we're inserting a good Bug ID.
# sure we're inserting a good Bug ID.
$bug
->
_sync_fulltext
(
'new bug'
);
$bug
->
_sync_fulltext
(
new_bug
=>
1
);
return
$bug
;
return
$bug
;
}
}
...
@@ -1026,9 +1026,10 @@ sub update {
...
@@ -1026,9 +1026,10 @@ sub update {
# in the middle of a transaction, and if that transaction is rolled
# in the middle of a transaction, and if that transaction is rolled
# back, this change will *not* be rolled back. As we expect rollbacks
# back, this change will *not* be rolled back. As we expect rollbacks
# to be extremely rare, that is OK for us.
# to be extremely rare, that is OK for us.
$self
->
_sync_fulltext
()
$self
->
_sync_fulltext
(
if
$self
->
{
added_comments
}
||
$changes
->
{
short_desc
}
update_short_desc
=>
$changes
->
{
short_desc
},
||
$self
->
{
comment_isprivate
};
update_comments
=>
$self
->
{
added_comments
}
||
$self
->
{
comment_isprivate
}
);
# Remove obsolete internal variables.
# Remove obsolete internal variables.
delete
$self
->
{
'_old_assigned_to'
};
delete
$self
->
{
'_old_assigned_to'
};
...
@@ -1062,25 +1063,43 @@ sub _extract_multi_selects {
...
@@ -1062,25 +1063,43 @@ sub _extract_multi_selects {
# Should be called any time you update short_desc or change a comment.
# Should be called any time you update short_desc or change a comment.
sub
_sync_fulltext
{
sub
_sync_fulltext
{
my
(
$self
,
$new_bug
)
=
@_
;
my
(
$self
,
%
options
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
if
(
$new_bug
)
{
$dbh
->
do
(
'INSERT INTO bugs_fulltext (bug_id, short_desc)
my
(
$all_comments
,
$public_comments
);
SELECT bug_id, short_desc FROM bugs WHERE bug_id = ?'
,
if
(
$options
{
new_bug
}
||
$options
{
update_comments
})
{
undef
,
$self
->
id
);
my
$comments
=
$dbh
->
selectall_arrayref
(
'SELECT thetext, isprivate FROM longdescs WHERE bug_id = ?'
,
undef
,
$self
->
id
);
$all_comments
=
join
(
"\n"
,
map
{
$_
->
[
0
]
}
@$comments
);
my
@no_private
=
grep
{
!
$_
->
[
1
]
}
@$comments
;
$public_comments
=
join
(
"\n"
,
map
{
$_
->
[
0
]
}
@no_private
);
}
}
else
{
$dbh
->
do
(
'UPDATE bugs_fulltext SET short_desc = ? WHERE bug_id = ?'
,
if
(
$options
{
new_bug
})
{
undef
,
$self
->
short_desc
,
$self
->
id
);
$dbh
->
do
(
'INSERT INTO bugs_fulltext (bug_id, short_desc, comments,
comments_noprivate)
VALUES (?, ?, ?, ?)'
,
undef
,
$self
->
id
,
$self
->
short_desc
,
$all_comments
,
$public_comments
);
}
else
{
my
(
@names
,
@values
);
if
(
$options
{
update_short_desc
})
{
push
@names
,
'short_desc'
;
push
@values
,
$self
->
short_desc
;
}
if
(
$options
{
update_comments
})
{
push
@names
,
(
'comments'
,
'comments_noprivate'
);
push
@values
,
(
$all_comments
,
$public_comments
);
}
if
(
@names
)
{
$dbh
->
do
(
'UPDATE bugs_fulltext SET '
.
join
(
', '
,
map
{
"$_ = ?"
}
@names
)
.
' WHERE bug_id = ?'
,
undef
,
@values
,
$self
->
id
);
}
}
}
my
$comments
=
$dbh
->
selectall_arrayref
(
'SELECT thetext, isprivate FROM longdescs WHERE bug_id = ?'
,
undef
,
$self
->
id
);
my
$all
=
join
(
"\n"
,
map
{
$_
->
[
0
]
}
@$comments
);
my
@no_private
=
grep
{
!
$_
->
[
1
]
}
@$comments
;
my
$nopriv_string
=
join
(
"\n"
,
map
{
$_
->
[
0
]
}
@no_private
);
$dbh
->
do
(
'UPDATE bugs_fulltext SET comments = ?, comments_noprivate = ?
WHERE bug_id = ?'
,
undef
,
$all
,
$nopriv_string
,
$self
->
id
);
}
}
sub
remove_from_db
{
sub
remove_from_db
{
...
...
Bugzilla/Comment.pm
View file @
db29480b
...
@@ -80,7 +80,7 @@ use constant VALIDATOR_DEPENDENCIES => {
...
@@ -80,7 +80,7 @@ use constant VALIDATOR_DEPENDENCIES => {
sub
update
{
sub
update
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$changes
=
$self
->
SUPER::
update
(
@_
);
my
$changes
=
$self
->
SUPER::
update
(
@_
);
$self
->
bug
->
_sync_fulltext
();
$self
->
bug
->
_sync_fulltext
(
update_comments
=>
1
);
return
$changes
;
return
$changes
;
}
}
...
...
Bugzilla/Migrate.pm
View file @
db29480b
...
@@ -815,7 +815,7 @@ sub _insert_comments {
...
@@ -815,7 +815,7 @@ sub _insert_comments {
$self
->
_do_table_insert
(
'longdescs'
,
\%
copy
);
$self
->
_do_table_insert
(
'longdescs'
,
\%
copy
);
$self
->
debug
(
" Inserted comment from "
.
$who
->
login
,
2
);
$self
->
debug
(
" Inserted comment from "
.
$who
->
login
,
2
);
}
}
$bug
->
_sync_fulltext
();
$bug
->
_sync_fulltext
(
update_comments
=>
1
);
}
}
sub
_insert_history
{
sub
_insert_history
{
...
...
importxml.pl
View file @
db29480b
...
@@ -1192,7 +1192,7 @@ sub process_bug {
...
@@ -1192,7 +1192,7 @@ sub process_bug {
$c
->
{
isprivate
},
$c
->
{
thetext
},
0
);
$c
->
{
isprivate
},
$c
->
{
thetext
},
0
);
}
}
$sth_comment
->
execute
(
$id
,
$exporterid
,
$timestamp
,
0
,
$comments
,
$worktime
);
$sth_comment
->
execute
(
$id
,
$exporterid
,
$timestamp
,
0
,
$comments
,
$worktime
);
Bugzilla::
Bug
->
new
(
$id
)
->
_sync_fulltext
(
'new_bug'
);
Bugzilla::
Bug
->
new
(
$id
)
->
_sync_fulltext
(
new_bug
=>
1
);
# Add this bug to each group of which its product is a member.
# Add this bug to each group of which its product is a member.
my
$sth_group
=
$dbh
->
prepare
(
"INSERT INTO bug_group_map (bug_id, group_id)
my
$sth_group
=
$dbh
->
prepare
(
"INSERT INTO bug_group_map (bug_id, group_id)
...
...
sanitycheck.cgi
View file @
db29480b
...
@@ -207,7 +207,7 @@ if ($cgi->param('repair_bugs_fulltext')) {
...
@@ -207,7 +207,7 @@ if ($cgi->param('repair_bugs_fulltext')) {
WHERE bugs_fulltext.bug_id IS NULL'
);
WHERE bugs_fulltext.bug_id IS NULL'
);
foreach
my
$bugid
(
@$bug_ids
)
{
foreach
my
$bugid
(
@$bug_ids
)
{
Bugzilla::
Bug
->
new
(
$bugid
)
->
_sync_fulltext
(
'new_bug'
);
Bugzilla::
Bug
->
new
(
$bugid
)
->
_sync_fulltext
(
new_bug
=>
1
);
}
}
Status
(
'bugs_fulltext_fixed'
,
{
bug_count
=>
scalar
(
@$bug_ids
)});
Status
(
'bugs_fulltext_fixed'
,
{
bug_count
=>
scalar
(
@$bug_ids
)});
...
...
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