Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93177557
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
Tue, Nov 26, 19:18
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 19:18 (2 d)
Engine
blob
Format
Raw Data
Handle
22587478
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