Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F72066102
ConduitAPI_file_info_Method.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, Jul 14, 12:44
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jul 16, 12:44 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
19028781
Attached To
rPH Phabricator
ConduitAPI_file_info_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_file_info_Method
extends
ConduitAPIMethod
{
public
function
getMethodDescription
()
{
return
"Get information about a file."
;
}
public
function
defineParamTypes
()
{
return
array
(
'phid'
=>
'optional phid'
,
'id'
=>
'optional id'
,
);
}
public
function
defineReturnType
()
{
return
'nonempty dict'
;
}
public
function
defineErrorTypes
()
{
return
array
(
'ERR-NOT-FOUND'
=>
'No such file exists.'
,
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$phid
=
$request
->
getValue
(
'phid'
);
$id
=
$request
->
getValue
(
'id'
);
if
(
$id
)
{
$file
=
id
(
new
PhabricatorFile
())->
load
(
$id
);
}
else
{
$file
=
id
(
new
PhabricatorFile
())->
loadOneWhere
(
'phid = %s'
,
$phid
);
}
if
(!
$file
)
{
throw
new
ConduitException
(
'ERR-NOT-FOUND'
);
}
$uri
=
$file
->
getBestURI
();
return
array
(
'id'
=>
$file
->
getID
(),
'phid'
=>
$file
->
getPHID
(),
'objectName'
=>
'F'
.
$file
->
getID
(),
'name'
=>
$file
->
getName
(),
'mimeType'
=>
$file
->
getMimeType
(),
'byteSize'
=>
$file
->
getByteSize
(),
'authorPHID'
=>
$file
->
getAuthorPHID
(),
'dateCreated'
=>
$file
->
getDateCreated
(),
'dateModified'
=>
$file
->
getDateModified
(),
'uri'
=>
PhabricatorEnv
::
getProductionURI
(
$uri
),
);
}
}
Event Timeline
Log In to Comment