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 307011 Details for
Bug 445607
RFE: XML-RPC method bug.setAttachmentsMIMETypes(bug.structData["attachments"])
[?]
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]
Patch adding bugzilla.updateAttachMimeType() to 3.2 (v2)
update_attach_mimetype_3.patch (text/plain), 3.53 KB, created by
David Lawrence
on 2008-05-29 03:45:09 UTC
(
hide
)
Description:
Patch adding bugzilla.updateAttachMimeType() to 3.2 (v2)
Filename:
MIME Type:
Creator:
David Lawrence
Created:
2008-05-29 03:45:09 UTC
Size:
3.53 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.36 >diff -u -r1.36 webservice.pl >--- extensions/compat_xmlrpc/code/webservice.pl 28 May 2008 16:53:32 -0000 1.36 >+++ extensions/compat_xmlrpc/code/webservice.pl 29 May 2008 03:44:04 -0000 >@@ -3052,6 +3052,83 @@ > return [\@comps, \@vers]; > } > >+=item C<updateAttachMimeType($data_ref, $username, $password)> >+ >+Update the attachment mime type of an attachment. The first argument is a data hash containing >+information on the new MIME type and the attachment id that you want to act on. >+ >+ $data_ref = { >+ "attach_id" => "<Attachment ID>", >+ # Attachment ID to perform MIME type change on. >+ "mime_type" => "<New MIME Type Value>", >+ # Legal MIME type value that you want to change the attachment to. >+ "nomail" => 0, >+ # OPTIONAL Flag that is either 1 or 0 if you want email to be sent or not for this change >+ }; >+ >+=cut >+ >+sub updateAttachMimeType { >+ my ( $self, $data_ref, $username, $password ) = @_; >+ my $dbh = Bugzilla->dbh; >+ >+ # Try to login if $username and $password provided. >+ xmlrpc_client_login($username, $password, LOGIN_REQUIRED); >+ >+ my $attach_id = $data_ref->{attach_id}; >+ my $mime_type = $data_ref->{mime_type}; >+ >+ $logger->debug("Starting: $attach_id, $mime_type, " . Bugzilla->user->login); >+ >+ $attach_id || ThrowCodeError('param_required', { param => 'attach_id' }); >+ $mime_type || ThrowCodeError('param_required', { param => 'mime_type' }); >+ >+ my $sth = $dbh->prepare( >+ "SELECT bug_id, mimetype, submitter_id FROM attachments WHERE attach_id = $attach_id" ); >+ $sth->execute(); >+ my ( $bug_id, $old_mime_type, $submitter_id ) = $sth->fetchrow_array(); >+ >+ $bug_id || ThrowUserError('invalid_attach_id', >+ { attach_id => $attach_id }); >+ >+ # People in editbugs can edit all attachments >+ if ( (not Bugzilla->user->in_group("editbugs")) >+ && Bugzilla->user->id != $submitter_id ) { >+ ThrowUserError( "illegal_attachment_edit", >+ { attach_id => $attach_id } ); >+ } >+ >+ if ( $mime_type ne $old_mime_type ) { >+ # Update database value for attachment mimetype >+ $dbh->do( "UPDATE attachments SET mimetype = " >+ . $dbh->quote($mime_type) >+ . " WHERE attach_id = $attach_id" ); >+ >+ # update bugs_activity table with the change that happened to the mimetype >+ $sth = $dbh->prepare( >+ "SELECT id FROM fielddefs WHERE name = 'attachments.mimetype' "); >+ $sth->execute; >+ my $fieldid = $sth->fetchrow_array(); >+ >+ # Add log activity entry >+ $dbh->do( >+ "INSERT INTO bugs_activity (bug_id, who, bug_when, fieldid, added, removed) " . >+ "VALUES ($bug_id, " . Bugzilla->user->id . ", now(), $fieldid, '$mime_type', '$old_mime_type')" >+ ); >+ >+ # Update timestamp >+ $dbh->do("UPDATE bugs SET delta_ts = now() WHERE bug_id = $bug_id"); >+ >+ $data_ref->{nomail} ||= 0; >+ >+ # Generate email >+ if ( not $data_ref->{nomail} ) { >+ return Bugzilla::BugMail::Send( $bug_id, >+ { changer => Bugzilla->user->login }); >+ } >+ } >+} >+ > # helper sub to turn a product name into an id, checking that it exists > # and is accessible to the current user. > #sub _product_to_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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 445607
:
304813
|
306946
|
306947
|
306948
| 307011 |
307012