Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F4852530
FileDownloadConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
932 B
Referenced Files
None
Subscribers
None
FileDownloadConduitAPIMethod.php
View Options
<?php
final
class
FileDownloadConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
(
)
{
return
'file.download'
;
}
public
function
getMethodDescription
(
)
{
return
pht
(
'Download a file from the server.'
)
;
}
protected
function
defineParamTypes
(
)
{
return
array
(
'phid'
=>
'required phid'
,
)
;
}
protected
function
defineReturnType
(
)
{
return
'nonempty base64-bytes'
;
}
protected
function
defineErrorTypes
(
)
{
return
array
(
'ERR-BAD-PHID'
=>
pht
(
'No such file exists.'
)
,
)
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$phid
=
$request
->
getValue
(
'phid'
)
;
$file
=
id
(
new
PhabricatorFileQuery
(
)
)
->
setViewer
(
$request
->
getUser
(
)
)
->
withPHIDs
(
array
(
$phid
)
)
->
executeOne
(
)
;
if
(
!
$file
)
{
throw
new
ConduitException
(
'ERR-BAD-PHID'
)
;
}
return
base64_encode
(
$file
->
loadFileData
(
)
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Jun 9, 06:37 (1 d, 14 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1754309
Default Alt Text
FileDownloadConduitAPIMethod.php (932 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment