Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F104808617
PhutilAWSS3Future.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Wed, Mar 12, 14:03
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Mar 14, 14:03 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24857711
Attached To
rPHU libphutil
PhutilAWSS3Future.php
View Options
<?php
final
class
PhutilAWSS3Future
extends
PhutilAWSFuture
{
private
$bucket
;
public
function
getServiceName
()
{
return
's3'
;
}
public
function
setBucket
(
$bucket
)
{
$this
->
bucket
=
$bucket
;
return
$this
;
}
public
function
getBucket
()
{
return
$this
->
bucket
;
}
public
function
setParametersForGetObject
(
$key
)
{
$bucket
=
$this
->
getBucket
();
$this
->
setHTTPMethod
(
'GET'
);
$this
->
setPath
(
$bucket
.
'/'
.
$key
);
return
$this
;
}
public
function
setParametersForPutObject
(
$key
,
$value
)
{
$bucket
=
$this
->
getBucket
();
$this
->
setHTTPMethod
(
'PUT'
);
$this
->
setPath
(
$bucket
.
'/'
.
$key
);
$this
->
addHeader
(
'X-Amz-ACL'
,
'private'
);
$this
->
addHeader
(
'Content-Type'
,
'application/octet-stream'
);
$this
->
setData
(
$value
);
return
$this
;
}
public
function
setParametersForDeleteObject
(
$key
)
{
$bucket
=
$this
->
getBucket
();
$this
->
setHTTPMethod
(
'DELETE'
);
$this
->
setPath
(
$bucket
.
'/'
.
$key
);
return
$this
;
}
protected
function
didReceiveResult
(
$result
)
{
list
(
$status
,
$body
,
$headers
)
=
$result
;
if
(!
$status
->
isError
())
{
return
$body
;
}
if
(
$status
->
getStatusCode
()
===
404
)
{
return
null
;
}
return
parent
::
didReceiveResult
(
$result
);
}
protected
function
shouldSignContent
()
{
return
true
;
}
}
Event Timeline
Log In to Comment