Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2891618
PhabricatorConfigCollectorsModule.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
PhabricatorConfigCollectorsModule.php
View Options
<?php
final
class
PhabricatorConfigCollectorsModule
extends
PhabricatorConfigModule
{
public
function
getModuleKey
(
)
{
return
'collectors'
;
}
public
function
getModuleName
(
)
{
return
pht
(
'Garbage Collectors'
)
;
}
public
function
renderModuleStatus
(
AphrontRequest
$request
)
{
$viewer
=
$request
->
getViewer
(
)
;
$collectors
=
PhabricatorGarbageCollector
::
getAllCollectors
(
)
;
$collectors
=
msort
(
$collectors
,
'getCollectorConstant'
)
;
$rows
=
array
(
)
;
$rowc
=
array
(
)
;
foreach
(
$collectors
as
$key
=>
$collector
)
{
$class
=
null
;
if
(
$collector
->
hasAutomaticPolicy
(
)
)
{
$policy_view
=
phutil_tag
(
'em'
,
array
(
)
,
pht
(
'Automatic'
)
)
;
}
else
{
$policy
=
$collector
->
getRetentionPolicy
(
)
;
if
(
$policy
===
null
)
{
$policy_view
=
pht
(
'Indefinite'
)
;
}
else
{
$days
=
ceil
(
$policy
/
phutil_units
(
'1 day in seconds'
)
)
;
$policy_view
=
pht
(
'%s Day(s)'
,
new
PhutilNumber
(
$days
)
)
;
}
$default
=
$collector
->
getDefaultRetentionPolicy
(
)
;
if
(
$policy
!==
$default
)
{
$class
=
'highlighted'
;
$policy_view
=
phutil_tag
(
'strong'
,
array
(
)
,
$policy_view
)
;
}
}
$rowc
[
]
=
$class
;
$rows
[
]
=
array
(
$collector
->
getCollectorConstant
(
)
,
$collector
->
getCollectorName
(
)
,
$policy_view
,
)
;
}
$info
=
id
(
new
PHUIInfoView
(
)
)
->
setSeverity
(
PHUIInfoView
::
SEVERITY_NOTICE
)
->
appendChild
(
pht
(
'Collectors with custom policies are highlighted. Use '
.
'%s to change retention policies.'
,
phutil_tag
(
'tt'
,
array
(
)
,
'bin/garbage set-policy'
)
)
)
;
$table
=
id
(
new
AphrontTableView
(
$rows
)
)
->
setNotice
(
$info
)
->
setRowClasses
(
$rowc
)
->
setHeaders
(
array
(
pht
(
'Constant'
)
,
pht
(
'Name'
)
,
pht
(
'Retention Policy'
)
,
)
)
->
setColumnClasses
(
array
(
null
,
'pri wide'
,
null
,
)
)
;
return
$table
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 15:29 (3 w, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1125997
Default Alt Text
PhabricatorConfigCollectorsModule.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment