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 297002 Details for
Bug 435665
Bugzilla data cleanup - bugs.reporter data cleanup
[?]
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.
change missed reporter to bugzilla@redhat.com
cleanup_reporter.pl (text/plain), 2.44 KB, created by
Tony Fu
on 2008-03-06 06:21:14 UTC
(
hide
)
Description:
change missed reporter to bugzilla@redhat.com
Filename:
MIME Type:
Creator:
Tony Fu
Created:
2008-03-06 06:21:14 UTC
Size:
2.44 KB
patch
obsolete
>#!/usr/bin/env perl >use strict; >use warnings; > >################################################################################ ># script: cleanup_reporter.pl ># purpose: some bugs' reporter doesn't have a valid userid in profiles table. ># This script assign the user bugzilla@redhat.com' as these bugs' ># reporter and update bugs_activity table accordingly. >################################################################################ > >use DBI; >use Carp; > > >############################################### ># variables of accessing pg db >############################################### > >my $user = 'bugs'; >my $pass = ''; >my $host = 'localhost'; >my $dsn = "dbi:mysql:dbname=bugs;host=$host"; > >my $dbh > = DBI->connect( $dsn, $user, $pass, { RaiseError => 1, PrintError => 0 } ) > or croak "Couldn't connect database: " . DBI->errstr; > ># bug_activity prepartion 1: ># get Admin User profiles.userid. Used in writing bug_activity ># get new reporter (bugzilla@redhat.com)'s userid >my $login_name = $dbh->quote('bugzilla@redhat.com'); >my $admin_user_id = $dbh->selectall_arrayref( > "SELECT userid > FROM profiles > WHERE login_name = $login_name" >)->[0][0]; >my $new_reporter_user_id = $admin_user_id; > ># bug_activity prepartion 2: ># get RESOLUTION's fieldid in fielddefs table >my $field_id = $dbh->selectall_arrayref( > "SELECT id > FROM fielddefs > WHERE name='reporter'" >)->[0][0]; > >#get bug_id of the bugs whose reporter is not in profiles table >my $sth = $dbh->prepare( >"SELECT bugs.bug_id, bugs.reporter FROM bugs LEFT JOIN profiles ON bugs.reporter = >profiles.userid WHERE profiles.userid IS NULL ORDER BY bugs.bug_id"); >$sth->execute(); > >while ( my ($bug_id, $old_reporter_user_id) = $sth->fetchrow_array() ) { > > #change reporter to user bugzilla@redhat.com's userid > $dbh->do( > "UPDATE bugs SET reporter='$new_reporter_user_id' WHERE bug_id=$bug_id" ); > > #update bugs_activity table > $dbh->do( > "INSERT INTO bugs_activity (who, > bug_when, > fieldid, > added, > removed, > bug_id) > VALUES ( $admin_user_id, > NOW(), > $field_id, > '$new_reporter_user_id', > '$old_reporter_user_id', > $bug_id )" > ); > >} >
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 Raw
Flags:
dkl
: review-
Actions:
View
Attachments on
bug 435665
:
297002
|
297141