Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 311372 Details for
Bug 454459
clean up NEEDINFO_* from bugzilla for 3.2 migration
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
v1 added code to clean up NEEDINFO_REPORTER status
needinfo_cleanup_patch (text/plain), 5.83 KB, created by
Noura El hawary
on 2008-07-09 13:05:19 UTC
(
hide
)
Description:
v1 added code to clean up NEEDINFO_REPORTER status
Filename:
MIME Type:
Creator:
Noura El hawary
Created:
2008-07-09 13:05:19 UTC
Size:
5.83 KB
patch
obsolete
>Index: redhat/needinfo_status_cleanup.pl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/redhat/needinfo_status_cleanup.pl,v >retrieving revision 1.1 >diff -p -u -r1.1 needinfo_status_cleanup.pl >--- redhat/needinfo_status_cleanup.pl 22 May 2008 06:42:54 -0000 1.1 >+++ redhat/needinfo_status_cleanup.pl 9 Jul 2008 13:02:01 -0000 >@@ -12,7 +12,7 @@ use DBI; > # bz: https://bugzilla.redhat.com/show_bug.cgi?id=446010 > > ############################################################################### >-# connect to the database >+# connect to the database and open file to write output to > ############################################################################### > my $user = 'bugs'; > my $pass = ''; >@@ -27,6 +27,10 @@ my $dbh = DBI->connect( > } > ) or die "Couldn't connect database: " . DBI->errstr; > >+my $log_file = 'needinfo_log'; >+open MYFILE, '>>', $log_file >+ or die "couldn't open $log_file: $!"; >+ > ############################################################################## > > my %changes_check = ( >@@ -37,9 +41,13 @@ my %changes_check = ( > status_bugs_all => 0, > status_bugs_no_flag => 0, > status_bugs_with_flag => 0, >+ needinfo_reporter_status_bugs_with_flag => 0, >+ needinfo_reporter_status_bugs_no_flag => 0, >+ needinfo_reporter_status_all => 0, > ); > > my $needinfo_status = 'NEEDINFO'; >+my $needinfo_reporter_status = 'NEEDINFO_REPORTER'; > my $flag_status = '?'; > my $needinfo_flag = 'needinfo?'; > >@@ -100,7 +108,7 @@ while ( my @row = $select_flag_sth->fetc > > my $query = "DELETE FROM flags WHERE id = $flag_id"; > if ( $bug_status eq 'CLOSED' ) { >- print "$query\n"; >+ print MYFILE "$query\n"; > $dbh->do($query); > log_activity( $bug_id, $flag_field_id, '', $needinfo_flag ); > $changes_check{flag_with_no_status_closed_bugs}++; >@@ -134,7 +142,7 @@ while ( my @row = $select_flag_sth->fetc > my $cmp_flag = &Date_Cmp($last_comment_date,$flag_creation_date); > > if ($cmp_flag > 0){ >- print "$query\n"; >+ print MYFILE "$query\n"; > $dbh->do($query); > log_activity( $bug_id, $flag_field_id, '', $needinfo_flag ); > $changes_check{flag_with_no_status_comment_bugs}++; >@@ -177,7 +185,50 @@ while ( my $bug_id = $select_status_sth- > > # 3- set the NEEDINFO status to inactive > $dbh->do("UPDATE bug_status SET isactive = 0 WHERE value = 'NEEDINFO'"); >-print Dumper(\%changes_check); >+ >+ >+# 4- find all bugs with current status set to NEEDINFO_REPORTER >+my $select_other_status_sth >+ = $dbh->prepare("SELECT bug_id, reporter FROM bugs where bug_status = ?"); >+$select_other_status_sth->execute($needinfo_reporter_status); >+while ( my @row = $select_other_status_sth->fetchrow_array() ) { >+ my ($bug_id, $reporter_id) = @row; >+ my $select_bug_flag = $dbh->prepare( " >+ SELECT id >+ FROM flags >+ WHERE bug_id = ? >+ AND type_id = ? >+ AND status = ? >+ AND requestee_id = ?" ); >+ $select_bug_flag->execute( $bug_id, $needinfo_flag_id, $flag_status, $reporter_id ); >+ my $flag_id = $select_bug_flag->fetchrow; >+ >+ if ($flag_id) { >+ $changes_check{needinfo_reporter_status_bugs_with_flag}++; >+ } >+ else { >+ $dbh->do( >+ "INSERT INTO flags >+ (type_id, status, bug_id, attach_id, creation_date, modification_date, setter_id, requestee_id) >+ VALUES ($needinfo_flag_id, '$flag_status', $bug_id, NULL, now(), now(), $changer_id, $reporter_id)" >+ ); >+ >+ my $select_reporter_login = $dbh->prepare("SELECT login_name >+ FROM profiles >+ WHERE userid = ?"); >+ $select_reporter_login->execute($reporter_id); >+ my $reporter_login = $select_reporter_login->fetchrow; >+ $needinfo_flag .= "($reporter_login)" if $reporter_login; >+ >+ >+ log_activity( $bug_id, $flag_field_id, $needinfo_flag, '' ); >+ $changes_check{needinfo_reporter_status_bugs_no_flag}++; >+ } >+ change_to_prev_status($bug_id, 1); >+ $changes_check{needinfo_reporter_status_all}++; >+} >+ >+print MYFILE Dumper(\%changes_check); > > sub log_activity { > my ( $bug, $field_id, $added, $removed ) = @_; >@@ -192,11 +243,11 @@ sub log_activity { > # Update timestamp > $dbh->do("UPDATE bugs SET delta_ts = now(), lastdiffed = now() WHERE bug_id = $bug"); > >- print "Updating Bug:$bug, Adding:$added, Removing:$removed\n"; >+ print MYFILE "Updating Bug:$bug, Adding:$added, Removing:$removed\n"; > } > > sub change_to_prev_status { >- my $bug = shift; >+ my ($bug, $needinfo_reporter) = @_; > > my $select_prev_status_sth = $dbh->prepare( " > SELECT removed >@@ -211,10 +262,17 @@ sub change_to_prev_status { > > my $query > = "UPDATE bugs SET bug_status = '$prev_status' WHERE bug_id = $bug"; >- print "$query\n"; >+ print MYFILE "$query\n"; > $dbh->do($query); > >- log_activity( $bug, $status_field_id, $prev_status, $needinfo_status ); >+ if ($needinfo_reporter) { >+ log_activity( $bug, $status_field_id, $prev_status, $needinfo_reporter_status ); >+ } >+ else { >+ log_activity( $bug, $status_field_id, $prev_status, $needinfo_status ); >+ } >+ >+ > } > > __END__ >@@ -249,3 +307,16 @@ NEEDINFO: > > 3- set the NEEDINFO status to inactive. > >+-------------------------------------- >+ >+4- find all bugs with current status set to NEEDINFO_REPORTER >+ >+ if bug has the needinfo?(reporter) flag set >+ set the bug status to prev active state >+ add log with with status change >+ else if needinfo?(reporter) flag is not set >+ set the needinfo?(reporter) flag >+ add log with the flag change >+ change status to previous active state >+ add log with status change >+
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dkl
: review+
Actions:
View
|
Diff
Attachments on
bug 454459
: 311372 |
311443