[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/fact/management/ -> PhabricatorFactManagementStatusWorkflow.php (source)

   1  <?php
   2  
   3  final class PhabricatorFactManagementStatusWorkflow
   4    extends PhabricatorFactManagementWorkflow {
   5  
   6    public function didConstruct() {
   7      $this
   8        ->setName('status')
   9        ->setSynopsis(pht('Show status of fact data.'))
  10        ->setArguments(array());
  11    }
  12  
  13    public function execute(PhutilArgumentParser $args) {
  14      $console = PhutilConsole::getConsole();
  15  
  16      $map = array(
  17        'raw' => new PhabricatorFactRaw(),
  18        'agg' => new PhabricatorFactAggregate(),
  19      );
  20  
  21      foreach ($map as $type => $table) {
  22        $conn = $table->establishConnection('r');
  23        $name = $table->getTableName();
  24  
  25        $row = queryfx_one(
  26          $conn,
  27          'SELECT COUNT(*) N FROM %T',
  28          $name);
  29  
  30        $n = $row['N'];
  31  
  32        switch ($type) {
  33          case 'raw':
  34            $desc = pht('There are %d raw fact(s) in storage.', $n);
  35            break;
  36          case 'agg':
  37            $desc = pht('There are %d aggregate fact(s) in storage.', $n);
  38            break;
  39        }
  40  
  41        $console->writeOut("%s\n", $desc);
  42      }
  43  
  44      return 0;
  45    }
  46  
  47  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1