Path: blob/master/src/applications/fact/management/PhabricatorFactManagementDestroyWorkflow.php
12256 views
<?php12final class PhabricatorFactManagementDestroyWorkflow3extends PhabricatorFactManagementWorkflow {45protected function didConstruct() {6$this7->setName('destroy')8->setSynopsis(pht('Destroy all facts.'))9->setArguments(array());10}1112public function execute(PhutilArgumentParser $args) {13$console = PhutilConsole::getConsole();1415$question = pht(16'Really destroy all facts? They will need to be rebuilt through '.17'analysis, which may take some time.');1819$ok = $console->confirm($question, $default = false);20if (!$ok) {21return 1;22}2324$tables = array();25$tables[] = new PhabricatorFactCursor();2627$tables[] = new PhabricatorFactIntDatapoint();2829$tables[] = new PhabricatorFactObjectDimension();30$tables[] = new PhabricatorFactKeyDimension();3132foreach ($tables as $table) {33$conn = $table->establishConnection('w');34$name = $table->getTableName();3536$console->writeOut("%s\n", pht("Destroying table '%s'...", $name));3738queryfx(39$conn,40'TRUNCATE TABLE %T',41$name);42}4344$console->writeOut("%s\n", pht('Done.'));45}4647}484950