Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F122154939
ConduitAPI_macro_query_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
Wed, Jul 16, 05:26
Size
1 KB
Mime Type
text/x-php
Expires
Fri, Jul 18, 05:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27441866
Attached To
rPH Phabricator
ConduitAPI_macro_query_Method.php
View Options
<?php
/**
* @group conduit
*/
final
class
ConduitAPI_macro_query_Method
extends
ConduitAPI_macro_Method
{
public
function
getMethodDescription
()
{
return
"Retrieve image macro information."
;
}
public
function
defineParamTypes
()
{
return
array
(
);
}
public
function
defineReturnType
()
{
return
'list<dict>'
;
}
public
function
defineErrorTypes
()
{
return
array
(
);
}
protected
function
execute
(
ConduitAPIRequest
$request
)
{
$macros
=
id
(
new
PhabricatorFileImageMacro
())->
loadAll
();
$files
=
array
();
if
(
$macros
)
{
$files
=
id
(
new
PhabricatorFile
())->
loadAllWhere
(
'phid IN (%Ls)'
,
mpull
(
$macros
,
'getFilePHID'
));
$files
=
mpull
(
$files
,
null
,
'getPHID'
);
}
$results
=
array
();
foreach
(
$macros
as
$macro
)
{
if
(
empty
(
$files
[
$macro
->
getFilePHID
()]))
{
continue
;
}
$results
[
$macro
->
getName
()]
=
array
(
'uri'
=>
$files
[
$macro
->
getFilePHID
()]->
getBestURI
(),
);
}
return
$results
;
}
}
Event Timeline
Log In to Comment