Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F100701691
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
Sun, Feb 2, 00:37
Size
961 B
Mime Type
text/x-php
Expires
Tue, Feb 4, 00:37 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
24017073
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