Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F447898
FileInfoConduitAPIMethod.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
FileInfoConduitAPIMethod.php
View Options
<?php
final
class
FileInfoConduitAPIMethod
extends
FileConduitAPIMethod
{
public
function
getAPIMethodName
()
{
return
'file.info'
;
}
public
function
getMethodDescription
()
{
return
pht
(
'Get information about a file.'
);
}
protected
function
defineParamTypes
()
{
return
array
(
'phid'
=>
'optional phid'
,
'id'
=>
'optional id'
,
);
}
protected
function
defineReturnType
()
{
return
'nonempty dict'
;
}
protected
function
defineErrorTypes
()
{
return
array
(
'ERR-NOT-FOUND'
=>
pht
(
'No such file exists.'
),
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$phid
=
$request
->
getValue
(
'phid'
);
$id
=
$request
->
getValue
(
'id'
);
$query
=
id
(
new
PhabricatorFileQuery
())
->
setViewer
(
$request
->
getUser
());
if
(
$id
)
{
$query
->
withIDs
(
array
(
$id
));
}
else
{
$query
->
withPHIDs
(
array
(
$phid
));
}
$file
=
$query
->
executeOne
();
if
(!
$file
)
{
throw
new
ConduitException
(
'ERR-NOT-FOUND'
);
}
$uri
=
$file
->
getInfoURI
();
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
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, May 4, 5:35 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
66251
Default Alt Text
FileInfoConduitAPIMethod.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment