Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F559617
HeraldRuleIndexEngineExtension.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
HeraldRuleIndexEngineExtension.php
View Options
<?php
final
class
HeraldRuleIndexEngineExtension
extends
PhabricatorEdgeIndexEngineExtension
{
const
EXTENSIONKEY
=
'herald.actions'
;
public
function
getExtensionName
()
{
return
pht
(
'Herald Actions'
);
}
public
function
shouldIndexObject
(
$object
)
{
if
(!(
$object
instanceof
HeraldRule
))
{
return
false
;
}
return
true
;
}
protected
function
getIndexEdgeType
()
{
return
HeraldRuleActionAffectsObjectEdgeType
::
EDGECONST
;
}
protected
function
getIndexDestinationPHIDs
(
$object
)
{
$rule
=
$object
;
$viewer
=
$this
->
getViewer
();
$rule
=
id
(
new
HeraldRuleQuery
())
->
setViewer
(
$viewer
)
->
withIDs
(
array
(
$rule
->
getID
()))
->
needConditionsAndActions
(
true
)
->
executeOne
();
if
(!
$rule
)
{
return
array
();
}
$phids
=
array
();
$fields
=
HeraldField
::
getAllFields
();
foreach
(
$rule
->
getConditions
()
as
$condition_record
)
{
$field
=
idx
(
$fields
,
$condition_record
->
getFieldName
());
if
(!
$field
)
{
continue
;
}
$affected_phids
=
$field
->
getPHIDsAffectedByCondition
(
$condition_record
);
foreach
(
$affected_phids
as
$phid
)
{
$phids
[]
=
$phid
;
}
}
$actions
=
HeraldAction
::
getAllActions
();
foreach
(
$rule
->
getActions
()
as
$action_record
)
{
$action
=
idx
(
$actions
,
$action_record
->
getAction
());
if
(!
$action
)
{
continue
;
}
foreach
(
$action
->
getPHIDsAffectedByAction
(
$action_record
)
as
$phid
)
{
$phids
[]
=
$phid
;
}
}
$phids
=
array_fuse
(
$phids
);
return
array_keys
(
$phids
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 12, 10:36 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
121272
Default Alt Text
HeraldRuleIndexEngineExtension.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment