Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99058115
FileQueryChunksConduitAPIMethod.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
Sat, Jan 18, 19:10
Size
961 B
Mime Type
text/x-php
Expires
Mon, Jan 20, 19:10 (2 d)
Engine
blob
Format
Raw Data
Handle
23698807
Attached To
rPH Phabricator
FileQueryChunksConduitAPIMethod.php
View Options
<?php
final
class
FileQueryChunksConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'file.querychunks'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Get information about file chunks.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'filePHID'
=>
'phid'
,
);
}
protected
function
defineReturnType
()
{
return
'list<wild>'
;
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$viewer
=
$request
->
getUser
();
$file_phid
=
$request
->
getValue
(
'filePHID'
);
$file
=
$this
->
loadFileByPHID
(
$viewer
,
$file_phid
);
$chunks
=
$this
->
loadFileChunks
(
$viewer
,
$file
);
$results
=
array
();
foreach
(
$chunks
as
$chunk
)
{
$results
[]
=
array
(
'byteStart'
=>
$chunk
->
getByteStart
(),
'byteEnd'
=>
$chunk
->
getByteEnd
(),
'complete'
=>
(
bool
)
$chunk
->
getDataFilePHID
(),
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment