[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

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

   1  <?php
   2  
   3  final class PhabricatorFactManagementDestroyWorkflow
   4    extends PhabricatorFactManagementWorkflow {
   5  
   6    public function didConstruct() {
   7      $this
   8        ->setName('destroy')
   9        ->setSynopsis(pht('Destroy all facts.'))
  10        ->setArguments(array());
  11    }
  12  
  13    public function execute(PhutilArgumentParser $args) {
  14      $console = PhutilConsole::getConsole();
  15  
  16      $question = pht(
  17        'Really destroy all facts? They will need to be rebuilt through '.
  18        'analysis, which may take some time.');
  19  
  20      $ok = $console->confirm($question, $default = false);
  21      if (!$ok) {
  22        return 1;
  23      }
  24  
  25      $tables = array();
  26      $tables[] = new PhabricatorFactRaw();
  27      $tables[] = new PhabricatorFactAggregate();
  28      foreach ($tables as $table) {
  29        $conn = $table->establishConnection('w');
  30        $name = $table->getTableName();
  31  
  32        $console->writeOut("%s\n", pht("Destroying table '%s'...", $name));
  33  
  34        queryfx(
  35          $conn,
  36          'TRUNCATE TABLE %T',
  37          $name);
  38      }
  39  
  40      $console->writeOut("%s\n", pht('Done.'));
  41    }
  42  
  43  }


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