mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-14 16:51:08 +01:00
daadf95537
Summary: Ref T6822. Test Plan: `grep`. This method is only called from within `PhutilArgumentWorkflow::__construct`. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin, epriestley Maniphest Tasks: T6822 Differential Revision: https://secure.phabricator.com/D11415
47 lines
1 KiB
PHP
47 lines
1 KiB
PHP
<?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;
|
|
}
|
|
|
|
}
|