1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
Bugzilla::Attachment</title>
6
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
<link rel="stylesheet" title="style" type="text/css" href="../style.css" media="all" >
11
<p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents"><<</a></b></p>
12
<h1>Bugzilla::Attachment</h1>
13
<div class='indexgroup'>
14
<ul class='indexList indexList1'>
15
<li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
16
<li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
17
<li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
18
<ul class='indexList indexList2'>
19
<li class='indexItem indexItem2'><a href='#Instance_Properties'>Instance Properties</a>
20
<li class='indexItem indexItem2'><a href='#Class_Methods'>Class Methods</a>
25
<h1><a class='u' href='#___top' title='click to go to top of document'
29
<p>Bugzilla::Attachment - a file related to a bug that a user has uploaded to the Bugzilla server</p>
31
<h1><a class='u' href='#___top' title='click to go to top of document'
35
<pre class="code"> use Bugzilla::Attachment;
37
# Get the attachment with the given ID.
38
my $attachment = Bugzilla::Attachment->get($attach_id);
40
# Get the attachments with the given IDs.
41
my $attachments = Bugzilla::Attachment->get_list($attach_ids);</pre>
43
<h1><a class='u' href='#___top' title='click to go to top of document'
47
<p>This module defines attachment objects, which represent files related to bugs that users upload to the Bugzilla server.</p>
49
<h2><a class='u' href='#___top' title='click to go to top of document'
50
name="Instance_Properties"
51
>Instance Properties</a></h2>
55
><code class="code">id</code></a></dt>
58
<p>the unique identifier for the attachment</p>
64
><code class="code">bug_id</code></a></dt>
67
<p>the ID of the bug to which the attachment is attached</p>
72
<dt><a name="description"
73
><code class="code">description</code></a></dt>
76
<p>user-provided text describing the attachment</p>
81
<dt><a name="contenttype"
82
><code class="code">contenttype</code></a></dt>
85
<p>the attachment's MIME media type</p>
90
<dt><a name="attacher"
91
><code class="code">attacher</code></a></dt>
94
<p>the user who attached the attachment</p>
99
<dt><a name="attached"
100
><code class="code">attached</code></a></dt>
103
<p>the date and time on which the attacher attached the attachment</p>
108
<dt><a name="filename"
109
><code class="code">filename</code></a></dt>
112
<p>the name of the file the attacher attached</p>
117
<dt><a name="ispatch"
118
><code class="code">ispatch</code></a></dt>
121
<p>whether or not the attachment is a patch</p>
127
><code class="code">isurl</code></a></dt>
130
<p>whether or not the attachment is a URL</p>
135
<dt><a name="isobsolete"
136
><code class="code">isobsolete</code></a></dt>
139
<p>whether or not the attachment is obsolete</p>
144
<dt><a name="isprivate"
145
><code class="code">isprivate</code></a></dt>
148
<p>whether or not the attachment is private</p>
154
><code class="code">data</code></a></dt>
157
<p>the content of the attachment</p>
162
<dt><a name="datasize"
163
><code class="code">datasize</code></a></dt>
166
<p>the length (in characters) of the attachment content</p>
172
><code class="code">flags</code></a></dt>
175
<p>flags that have been set on the attachment</p>
179
<h2><a class='u' href='#___top' title='click to go to top of document'
181
>Class Methods</a></h2>
184
<dt><a name="get_attachments_by_bug($bug_id)"
185
><code class="code">get_attachments_by_bug($bug_id)</code></a></dt>
188
<p>Description: retrieves and returns the attachments the currently logged in user can view for the given bug.</p>
190
<p>Params: <code class="code">$bug_id</code> - integer - the ID of the bug for which to retrieve and return attachments.</p>
192
<p>Returns: a reference to an array of attachment objects.</p>
194
<dt><a name="validate_is_patch()"
195
><code class="code">validate_is_patch()</code></a></dt>
198
<p>Description: validates the "patch" flag passed in by CGI.</p>
200
<p>Returns: 1 on success.</p>
202
<dt><a name="validate_description()"
203
><code class="code">validate_description()</code></a></dt>
206
<p>Description: validates the description passed in by CGI.</p>
208
<p>Returns: 1 on success.</p>
210
<dt><a name="validate_content_type()"
211
><code class="code">validate_content_type()</code></a></dt>
214
<p>Description: validates the content type passed in by CGI.</p>
216
<p>Returns: 1 on success.</p>
218
<dt><a name="validate_can_edit($attachment,_$product_id)"
219
><code class="code">validate_can_edit($attachment, $product_id)</code></a></dt>
222
<p>Description: validates if the user is allowed to view and edit the attachment. Only the submitter or someone with editbugs privs can edit it. Only the submitter and users in the insider group can view private attachments.</p>
224
<p>Params: $attachment - the attachment object being edited. $product_id - the product ID the attachment belongs to.</p>
226
<p>Returns: 1 on success. Else an error is thrown.</p>
228
<dt><a name="validate_obsolete($bug)"
229
><code class="code">validate_obsolete($bug)</code></a></dt>
232
<p>Description: validates if attachments the user wants to mark as obsolete really belong to the given bug and are not already obsolete. Moreover, a user cannot mark an attachment as obsolete if he cannot view it (due to restrictions on it).</p>
234
<p>Params: $bug - The bug object obsolete attachments should belong to.</p>
236
<p>Returns: 1 on success. Else an error is thrown.</p>
238
<dt><a name="insert_attachment_for_bug($throw_error,_$bug,_$user,_$timestamp,_$hr_vars)"
239
><code class="code">insert_attachment_for_bug($throw_error, $bug, $user, $timestamp, $hr_vars)</code></a></dt>
242
<p>Description: inserts an attachment from CGI input for the given bug.</p>
244
<p>Params: <code class="code">$bug</code> - Bugzilla::Bug object - the bug for which to insert the attachment. <code class="code">$user</code> - Bugzilla::User object - the user we're inserting an attachment for. <code class="code">$timestamp</code> - scalar - timestamp of the insert as returned by SELECT NOW(). <code class="code">$hr_vars</code> - hash reference - reference to a hash of template variables.</p>
246
<p>Returns: the ID of the new attachment.</p>
249
<p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents"><<</a></b></p>