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
ab04fe6c
Commit
ab04fe6c
authored
Jul 07, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 577149: Make convert-workflow rename values in saved searches
r=LpSolit, a=LpSolit
parent
8c9cd344
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
1 deletion
+35
-1
Saved.pm
Bugzilla/Search/Saved.pm
+31
-0
convert-workflow.pl
contrib/convert-workflow.pl
+4
-1
No files found.
Bugzilla/Search/Saved.pm
View file @
ab04fe6c
...
...
@@ -174,6 +174,37 @@ sub create {
return
$obj
;
}
sub
rename_field_value
{
my
(
$class
,
$field
,
$old_value
,
$new_value
)
=
@_
;
my
$old
=
url_quote
(
$old_value
);
my
$new
=
url_quote
(
$new_value
);
my
$old_sql
=
$old
;
$old_sql
=~
s/([_\%])/\\$1/g
;
my
$dbh
=
Bugzilla
->
dbh
;
$dbh
->
bz_start_transaction
();
my
%
queries
=
@
{
$dbh
->
selectcol_arrayref
(
"SELECT id, query FROM namedqueries WHERE query LIKE ?"
,
{
Columns
=>
[
1
,
2
]},
"\%$old_sql\%"
)
};
foreach
my
$id
(
keys
%
queries
)
{
my
$query
=
$queries
{
$id
};
$query
=~
s/\b$field=\Q$old\E\b/$field=$new/gi
;
# Fix boolean charts.
while
(
$query
=~
/\bfield(\d+-\d+-\d+)=\Q$field\E\b/gi
)
{
my
$chart_id
=
$1
;
# Note that this won't handle lists or substrings inside of
# boolean charts. Users will have to fix those themselves.
$query
=~
s/\bvalue\Q$chart_id\E=\Q$old\E\b/value$chart_id=$new/i
;
}
$dbh
->
do
(
"UPDATE namedqueries SET query = ? WHERE id = ?"
,
undef
,
$query
,
$id
);
}
$dbh
->
bz_commit_transaction
();
}
sub
preload
{
my
(
$searches
)
=
@_
;
my
$dbh
=
Bugzilla
->
dbh
;
...
...
contrib/convert-workflow.pl
View file @
ab04fe6c
...
...
@@ -25,6 +25,7 @@ use lib qw(. lib);
use
Bugzilla
;
use
Bugzilla::
Config
qw(:admin)
;
use
Bugzilla::Search::
Saved
;
use
Bugzilla::
Status
;
my
$confirmed
=
new
Bugzilla::
Status
({
name
=>
'CONFIRMED'
});
...
...
@@ -79,7 +80,7 @@ foreach my $pair (@translation) {
}
foreach
my
$what
(
qw(added removed)
)
{
$dbh
->
do
(
"UPDATE bugs_activity SET $what = ?
$dbh
->
do
(
"UPDATE bugs_activity SET $what = ?
WHERE fieldid = ? AND $what = ?"
,
undef
,
$to
,
$status_field
->
id
,
$from
);
}
...
...
@@ -99,6 +100,8 @@ foreach my $pair (@translation) {
$dbh
->
do
(
'UPDATE bug_status SET value = ? WHERE value = ?'
,
undef
,
$to
,
$from
);
}
Bugzilla::Search::
Saved
->
rename_field_value
(
'bug_status'
,
$from
,
$to
);
}
$dbh
->
bz_commit_transaction
();
...
...
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