Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F93174304
PhabricatorFactManagementStatusWorkflow.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, 18:46
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Nov 28, 18:46 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22586234
Attached To
rPH Phabricator
PhabricatorFactManagementStatusWorkflow.php
View Options
<?php
final
class
PhabricatorFactManagementStatusWorkflow
extends
PhabricatorFactManagementWorkflow
{
protected
function
didConstruct
()
{
$this
->
setName
(
'status'
)
->
setSynopsis
(
pht
(
'Show status of fact data.'
))
->
setArguments
(
array
());
}
public
function
execute
(
PhutilArgumentParser
$args
)
{
$console
=
PhutilConsole
::
getConsole
();
$map
=
array
(
'raw'
=>
new
PhabricatorFactRaw
(),
'agg'
=>
new
PhabricatorFactAggregate
(),
);
foreach
(
$map
as
$type
=>
$table
)
{
$conn
=
$table
->
establishConnection
(
'r'
);
$name
=
$table
->
getTableName
();
$row
=
queryfx_one
(
$conn
,
'SELECT COUNT(*) N FROM %T'
,
$name
);
$n
=
$row
[
'N'
];
switch
(
$type
)
{
case
'raw'
:
$desc
=
pht
(
'There are %d raw fact(s) in storage.'
,
$n
);
break
;
case
'agg'
:
$desc
=
pht
(
'There are %d aggregate fact(s) in storage.'
,
$n
);
break
;
}
$console
->
writeOut
(
"%s
\n
"
,
$desc
);
}
return
0
;
}
}
Event Timeline
Log In to Comment