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
ef925d69
Commit
ef925d69
authored
Feb 24, 2014
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 975896: Bugzilla crashes when editing a flag type which is not specifically requestable
r/a=glob
parent
97cd64da
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
17 deletions
+21
-17
Attachment.pm
Bugzilla/Attachment.pm
+4
-4
Classification.pm
Bugzilla/Classification.pm
+8
-7
FlagType.pm
Bugzilla/FlagType.pm
+9
-6
No files found.
Bugzilla/Attachment.pm
View file @
ef925d69
...
@@ -935,10 +935,10 @@ sub remove_from_db {
...
@@ -935,10 +935,10 @@ sub remove_from_db {
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
$dbh
->
bz_start_transaction
();
$dbh
->
bz_start_transaction
();
my
@flag_ids
=
$dbh
->
selectrow_array
(
my
$flag_ids
=
$dbh
->
selectcol_arrayref
(
'SELECT id FROM flags WHERE attach_id = ?'
,
undef
,
$self
->
id
);
'SELECT id FROM flags WHERE attach_id = ?'
,
undef
,
$self
->
id
);
$dbh
->
do
(
'DELETE FROM flags WHERE '
.
$dbh
->
sql_in
(
'id'
,
\
@
flag_ids
))
$dbh
->
do
(
'DELETE FROM flags WHERE '
.
$dbh
->
sql_in
(
'id'
,
$
flag_ids
))
if
@flag_ids
;
if
@
$
flag_ids
;
$dbh
->
do
(
'DELETE FROM attach_data WHERE id = ?'
,
undef
,
$self
->
id
);
$dbh
->
do
(
'DELETE FROM attach_data WHERE id = ?'
,
undef
,
$self
->
id
);
$dbh
->
do
(
'UPDATE attachments SET mimetype = ?, ispatch = ?, isobsolete = ?
$dbh
->
do
(
'UPDATE attachments SET mimetype = ?, ispatch = ?, isobsolete = ?
WHERE attach_id = ?'
,
undef
,
(
'text/plain'
,
0
,
1
,
$self
->
id
));
WHERE attach_id = ?'
,
undef
,
(
'text/plain'
,
0
,
1
,
$self
->
id
));
...
@@ -952,7 +952,7 @@ sub remove_from_db {
...
@@ -952,7 +952,7 @@ sub remove_from_db {
# As we don't call SUPER->remove_from_db we need to manually clear
# As we don't call SUPER->remove_from_db we need to manually clear
# memcached here.
# memcached here.
Bugzilla
->
memcached
->
clear
({
table
=>
'attachments'
,
id
=>
$self
->
id
});
Bugzilla
->
memcached
->
clear
({
table
=>
'attachments'
,
id
=>
$self
->
id
});
foreach
my
$flag_id
(
@flag_ids
)
{
foreach
my
$flag_id
(
@
$
flag_ids
)
{
Bugzilla
->
memcached
->
clear
({
table
=>
'flags'
,
id
=>
$flag_id
});
Bugzilla
->
memcached
->
clear
({
table
=>
'flags'
,
id
=>
$flag_id
});
}
}
}
}
...
...
Bugzilla/Classification.pm
View file @
ef925d69
...
@@ -48,6 +48,7 @@ use constant VALIDATORS => {
...
@@ -48,6 +48,7 @@ use constant VALIDATORS => {
###############################
###############################
#### Constructors #####
#### Constructors #####
###############################
###############################
sub
remove_from_db
{
sub
remove_from_db
{
my
$self
=
shift
;
my
$self
=
shift
;
my
$dbh
=
Bugzilla
->
dbh
;
my
$dbh
=
Bugzilla
->
dbh
;
...
@@ -57,13 +58,13 @@ sub remove_from_db {
...
@@ -57,13 +58,13 @@ sub remove_from_db {
$dbh
->
bz_start_transaction
();
$dbh
->
bz_start_transaction
();
# Reclassify products to the default classification, if needed.
# Reclassify products to the default classification, if needed.
my
@product_ids
=
$dbh
->
selectrow_array
(
my
$product_ids
=
$dbh
->
selectcol_arrayref
(
"SELECT id FROM products WHERE classification_id = ?"
,
'SELECT id FROM products WHERE classification_id = ?'
,
undef
,
$self
->
id
);
undef
,
$self
->
id
);
if
(
@product_ids
)
{
if
(
@
$
product_ids
)
{
$dbh
->
do
(
"UPDATE products SET classification_id = 1 WHERE "
.
$dbh
->
do
(
'UPDATE products SET classification_id = 1 WHERE '
$dbh
->
sql_in
(
'id'
,
\
@
product_ids
));
.
$dbh
->
sql_in
(
'id'
,
$
product_ids
));
foreach
my
$id
(
@product_ids
)
{
foreach
my
$id
(
@
$
product_ids
)
{
Bugzilla
->
memcached
->
clear
({
table
=>
'products'
,
id
=>
$id
});
Bugzilla
->
memcached
->
clear
({
table
=>
'products'
,
id
=>
$id
});
}
}
}
}
...
...
Bugzilla/FlagType.pm
View file @
ef925d69
...
@@ -185,12 +185,15 @@ sub update {
...
@@ -185,12 +185,15 @@ sub update {
# Silently remove requestees from flags which are no longer
# Silently remove requestees from flags which are no longer
# specifically requestable.
# specifically requestable.
if
(
!
$self
->
is_requesteeble
)
{
if
(
!
$self
->
is_requesteeble
)
{
my
@ids
=
$dbh
->
selectrow_array
(
my
$ids
=
$dbh
->
selectcol_arrayref
(
"SELECT id FROM flags WHERE type_id = ?"
,
undef
,
$self
->
id
);
'SELECT id FROM flags WHERE type_id = ? AND requestee_id IS NOT NULL'
,
$dbh
->
do
(
"UPDATE flags SET requestee_id = NULL WHERE "
undef
,
$self
->
id
);
.
$dbh
->
sql_in
(
'type_id'
,
\
@ids
));
foreach
my
$id
(
@ids
)
{
if
(
@$ids
)
{
Bugzilla
->
memcached
->
clear
({
table
=>
'flags'
,
id
=>
$id
});
$dbh
->
do
(
'UPDATE flags SET requestee_id = NULL WHERE '
.
$dbh
->
sql_in
(
'id'
,
$ids
));
foreach
my
$id
(
@$ids
)
{
Bugzilla
->
memcached
->
clear
({
table
=>
'flags'
,
id
=>
$id
});
}
}
}
}
}
...
...
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