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 306947 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 2.18 (v1)
update_attach_mimetype_2_18.patch (text/plain), 3.69 KB, created by
David Lawrence
on 2008-05-28 16:42:42 UTC
(
hide
)
Description:
Patch adding bugzilla.updateAttachMimeType() to 2.18 (v1)
Filename:
MIME Type:
Creator:
David Lawrence
Created:
2008-05-28 16:42:42 UTC
Size:
3.69 KB
patch
obsolete
>Index: Bugzilla/RPC/Bug.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_2_18/Bugzilla/RPC/Bug.pm,v >retrieving revision 1.85 >diff -u -r1.85 Bug.pm >--- Bugzilla/RPC/Bug.pm 1 Apr 2008 17:03:54 -0000 1.85 >+++ Bugzilla/RPC/Bug.pm 28 May 2008 16:37:45 -0000 >@@ -90,7 +90,8 @@ > getBugModified updateFlags updateWhiteboard getBugActivity > issueExists changeAssignment updateDepends ping updateGroups > updateMilestone updateCC getReleaseFlags updatePriority >- updateSeverity getBugFields updateKeywords getBugCVS updateVersion); >+ updateSeverity getBugFields updateKeywords getBugCVS >+ updateVersion updateAttachMimeType); > > our ($vars); > >@@ -2838,6 +2839,81 @@ > > } > >+=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 { >+ shift if $_[0] eq 'bugzilla'; >+ my ( $data_ref, $username, $password ) = @_; >+ my $dbh = Bugzilla->dbh; >+ >+ Bugzilla->login( RPC_AUTH_TYPE, $username, $password ); >+ >+ 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 || ThrowUserError('invalid_attach_id'); >+ $mime_type || ThrowUserError('invalid_content_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 ::UserInGroup("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 fieldid 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 >+ return Bugzilla::BugMail::Send( $bug_id, >+ { changer => Bugzilla->user->login }, $data_ref->{nomail} ); >+ } >+} >+ > > 1; >
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:
nelhawar
: review+
Actions:
View
|
Diff
Attachments on
bug 445607
:
304813
|
306946
|
306947
|
306948
|
307011
|
307012