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 314373 Details for
Bug 459220
port webservice function updateKeywords from BZ 2.18 to 3.2
[?]
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 for updateKeywords function
updateKeywords.patch (text/plain), 6.23 KB, created by
Noura El hawary
on 2008-08-15 04:57:57 UTC
(
hide
)
Description:
v1 for updateKeywords function
Filename:
MIME Type:
Creator:
Noura El hawary
Created:
2008-08-15 04:57:57 UTC
Size:
6.23 KB
patch
obsolete
>Index: extensions/compat_xmlrpc/code/webservice.pl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/extensions/compat_xmlrpc/code/webservice.pl,v >retrieving revision 1.49 >diff -p -u -r1.49 webservice.pl >--- extensions/compat_xmlrpc/code/webservice.pl 14 Aug 2008 15:57:34 -0000 1.49 >+++ extensions/compat_xmlrpc/code/webservice.pl 15 Aug 2008 04:48:03 -0000 >@@ -2213,132 +2213,33 @@ a string the contains list of the keywor > > =cut > >-#sub updateKeywords { >-# shift if $_[0] eq 'bugzilla'; >-# my ( $data_ref, $username, $password ) = @_; >-# >-# Bugzilla->login(RPC_AUTH_TYPE, $username, $password); >-# >-# $logger->debug("Starting: $data_ref->{bug_id}, $username"); >-# >-# ThrowUserError('bug_id_required') if !$data_ref->{bug_id}; >-# >-# # If the bug ID isn't numeric, it might be an alias, so try to convert it. >-# $data_ref->{bug_id} = ::BugAliasToID($data_ref->{bug_id}) if $data_ref->{bug_id} !~ /^[1-9][0-9]*$/; >-# >-# # Validate if can see this bug and if exists >-# my $bug = new Bugzilla::Bug($data_ref->{bug_id}, $::userid); >-# ThrowCodeError("bug_error", { bug => $bug }) if $bug->error; >-# >-# # Return if we cannot edit this bug value >-# if (!$bug->user->{'canedit'}) { >-# ThrowUserError('cannot_edit_bug'); >-# } >-# >-# if (!$data_ref->{'keywords'}){ >-# ThrowUserError('missing_keywords_for_update'); >-# } >-# >-# ::GetVersionTable(); >-# >-# my @keywordlist; >-# my %keywordseen; >-# foreach my $keyword (split(/[\s,]+/, $data_ref->{'keywords'})) { >-# if ($keyword eq '') { >-# next; >-# } >-# my $i = ::GetKeywordIdFromName($keyword); >-# if (!$i) { >-# ThrowUserError("unknown_keyword", >-# { keyword => $keyword }); >-# } >-# if (!$keywordseen{$i}) { >-# push(@keywordlist, $i); >-# $keywordseen{$i} = 1; >-# } >-# } >-# >-# >-# # if no action is provided or the action is provided but it is >-# # not valid then the default is makeexact >-# my $keywordaction = $data_ref->{'action'} || "makeexact"; >-# if (!grep($keywordaction eq $_, qw(add delete makeexact))) { >-# $keywordaction = "makeexact"; >-# } >-# >-# my $dbh = Bugzilla->dbh; >-# >-# # There are three kinds of "keywordsaction": makeexact, add, delete. >-# # For makeexact, we delete everything, and then add our things. >-# # For add, we delete things we're adding (to make sure we don't >-# # end up having them twice), and then we add them. >-# # For delete, we just delete things on the list. >-# my $changed = 0; >-# if ($keywordaction eq "makeexact") { >-# $dbh->do("DELETE FROM keywords WHERE bug_id = $data_ref->{bug_id}"); >-# $changed = 1; >-# } >-# foreach my $keyword (@keywordlist) { >-# if ($keywordaction ne "makeexact") { >-# $dbh->do("DELETE FROM keywords >-# WHERE bug_id = $data_ref->{bug_id} AND keywordid = $keyword"); >-# $changed = 1; >-# } >-# if ($keywordaction ne "delete") { >-# $dbh->do("INSERT INTO keywords >-# (bug_id, keywordid) VALUES ($data_ref->{bug_id}, $keyword)"); >-# $changed = 1; >-# } >-# } >-# >-# if ($changed) { >-# my $sth; >-# >-# $sth = $dbh->prepare("SELECT keywords FROM bugs WHERE bug_id = $data_ref->{bug_id}"); >-# $sth->execute(); >-# my $old_keywords = $sth->fetchrow_array(); >-# >-# $sth = $dbh->prepare("SELECT keyworddefs.name >-# FROM keyworddefs, keywords >-# WHERE keywords.bug_id = $data_ref->{bug_id} >-# AND keyworddefs.id = keywords.keywordid >-# ORDER BY keyworddefs.name"); >-# $sth->execute(); >-# my @list; >-# while (my ($keyword_name) = $sth->fetchrow_array() ) { >-# push(@list, $keyword_name); >-# } >-# my $new_keywords = join(', ', @list); >-# >-# $dbh->do("UPDATE bugs SET keywords = " . >-# $dbh->quote(join(', ', @list)) . >-# " WHERE bug_id = $data_ref->{bug_id}"); >-# >-# # update bugs_activity table with the change that happened to the keywords >-# $sth = $dbh->prepare("SELECT fieldid FROM fielddefs WHERE name = 'keywords' "); >-# $sth->execute; >-# my $fieldid = $sth->fetchrow_array(); >-# >-# >-# ($old_keywords, $new_keywords) = ::DiffStrings($old_keywords, $new_keywords); >-# >-# if ($old_keywords || $new_keywords){ >-# # Add log activity entry >-# $dbh->do("INSERT INTO bugs_activity >-# (bug_id, who, bug_when, fieldid, added, removed) >-# VALUES ($data_ref->{bug_id}, $::userid, now(), $fieldid, '$new_keywords', '$old_keywords')"); >-# >-# # Update timestamp >-# $dbh->do("UPDATE bugs SET delta_ts = now() WHERE bug_id = $data_ref->{bug_id}"); >-# >-# $data_ref->{nomail} ||= 0; >-# >-# # Generate email >-# return Bugzilla::BugMail::Send($data_ref->{bug_id}, { changer => $username }, $data_ref->{nomail}); >-# } >-# } >-# >-#} >+sub updateKeywords { >+ my ($self, $data_ref, $username, $password ) = @_; >+ >+ # Try to login if $username and $password provided. >+ xmlrpc_client_login($username, $password, LOGIN_REQUIRED); >+ >+ $logger->debug("Starting: $data_ref->{bug_id}, $username"); >+ >+ $data_ref->{bug_id} || ThrowCodeError( 'param_required', { param => 'bug id' } ); >+ $data_ref->{keywords} || ThrowCodeError( 'param_required', { param => 'keywords' } ); >+ $data_ref->{action} || ThrowCodeError( 'param_required', { param => 'action' } ); >+ >+ ValidateBugID($data_ref->{bug_id}); >+ my $bug = new Bugzilla::Bug($data_ref->{bug_id}); >+ >+ if (!Bugzilla->user->can_edit_product($bug->product_obj->id) ) { >+ ThrowUserError("product_edit_denied", >+ { product => $bug->product }); >+ } >+ >+ $bug->modify_keywords($data_ref->{keywords}, $data_ref->{action}); >+ >+ $bug->update; >+ >+ $data_ref->{nomail} ||= 0; >+ return Bugzilla::BugMail::Send($data_ref->{bug_id}, { changer => $username }) if !$data_ref->{nomail}; >+} > > sub login { > my ( $self, $username, $password, $remember ) = @_;
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 459220
: 314373