Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120814328
PhabricatorStorageManagementStatusWorkflow.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
Mon, Jul 7, 07:01
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Jul 9, 07:01 (2 d)
Engine
blob
Format
Raw Data
Handle
27253893
Attached To
rPH Phabricator
PhabricatorStorageManagementStatusWorkflow.php
View Options
<?php
final
class
PhabricatorStorageManagementStatusWorkflow
extends
PhabricatorStorageManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'status'
)
->
setExamples
(
'**status** [__options__]'
)
->
setSynopsis
(
pht
(
'Show patch application status.'
));
}
protected
function
isReadOnlyWorkflow
()
{
return
true
;
}
public
function
didExecute
(
PhutilArgumentParser
$args
)
{
foreach
(
$this
->
getAPIs
()
as
$api
)
{
$patches
=
$this
->
getPatches
();
$applied
=
$api
->
getAppliedPatches
();
if
(
$applied
===
null
)
{
echo
phutil_console_format
(
"**%s**: %s
\n
"
,
pht
(
'Database Not Initialized'
),
pht
(
'Run **%s** to initialize.'
,
'./bin/storage upgrade'
));
return
1
;
}
$ref
=
$api
->
getRef
();
$table
=
id
(
new
PhutilConsoleTable
())
->
setShowHeader
(
false
)
->
addColumn
(
'id'
,
array
(
'title'
=>
pht
(
'ID'
)))
->
addColumn
(
'host'
,
array
(
'title'
=>
pht
(
'Host'
)))
->
addColumn
(
'status'
,
array
(
'title'
=>
pht
(
'Status'
)))
->
addColumn
(
'duration'
,
array
(
'title'
=>
pht
(
'Duration'
)))
->
addColumn
(
'type'
,
array
(
'title'
=>
pht
(
'Type'
)))
->
addColumn
(
'name'
,
array
(
'title'
=>
pht
(
'Name'
)));
$durations
=
$api
->
getPatchDurations
();
foreach
(
$patches
as
$patch
)
{
$duration
=
idx
(
$durations
,
$patch
->
getFullKey
());
if
(
$duration
===
null
)
{
$duration
=
'-'
;
}
else
{
$duration
=
pht
(
'%s us'
,
new
PhutilNumber
(
$duration
));
}
$table
->
addRow
(
array
(
'id'
=>
$patch
->
getFullKey
(),
'host'
=>
$ref
->
getRefKey
(),
'status'
=>
in_array
(
$patch
->
getFullKey
(),
$applied
)
?
pht
(
'Applied'
)
:
pht
(
'Not Applied'
),
'duration'
=>
$duration
,
'type'
=>
$patch
->
getType
(),
'name'
=>
$patch
->
getName
(),
));
}
$table
->
draw
();
}
return
0
;
}
}
Event Timeline
Log In to Comment