Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98091410
DiffusionCacheEngineExtension.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
Thu, Jan 9, 16:49
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 16:49 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23505029
Attached To
rPH Phabricator
DiffusionCacheEngineExtension.php
View Options
<?php
final
class
DiffusionCacheEngineExtension
extends
PhabricatorCacheEngineExtension
{
const
EXTENSIONKEY
=
'diffusion'
;
public
function
getExtensionName
()
{
return
pht
(
'Diffusion Repositories'
);
}
public
function
discoverLinkedObjects
(
PhabricatorCacheEngine
$engine
,
array
$objects
)
{
$viewer
=
$engine
->
getViewer
();
$results
=
array
();
// When an Almanac Service changes, update linked repositories.
$services
=
$this
->
selectObjects
(
$objects
,
'AlmanacService'
);
if
(
$services
)
{
$repositories
=
id
(
new
PhabricatorRepositoryQuery
())
->
setViewer
(
$viewer
)
->
withAlmanacServicePHIDs
(
mpull
(
$services
,
'getPHID'
))
->
execute
();
foreach
(
$repositories
as
$repository
)
{
$results
[]
=
$repository
;
}
}
return
$results
;
}
public
function
deleteCaches
(
PhabricatorCacheEngine
$engine
,
array
$objects
)
{
$keys
=
array
();
$repositories
=
$this
->
selectObjects
(
$objects
,
'PhabricatorRepository'
);
foreach
(
$repositories
as
$repository
)
{
$keys
[]
=
$repository
->
getAlmanacServiceCacheKey
();
}
$keys
=
array_filter
(
$keys
);
if
(
$keys
)
{
$cache
=
PhabricatorCaches
::
getMutableStructureCache
();
$cache
->
deleteKeys
(
$keys
);
}
}
}
Event Timeline
Log In to Comment