3 final class PhabricatorConfigManagementDeleteWorkflow
4 extends PhabricatorConfigManagementWorkflow
{
6 protected function didConstruct() {
9 ->setExamples('**delete** __key__')
10 ->setSynopsis(pht('Delete a local configuration value.'))
16 'Delete configuration in the database instead of '.
17 'in local configuration.'),
26 public function execute(PhutilArgumentParser
$args) {
27 $console = PhutilConsole
::getConsole();
29 $argv = $args->getArg('args');
30 if (count($argv) == 0) {
31 throw new PhutilArgumentUsageException(
32 pht('Specify a configuration key to delete.'));
37 if (count($argv) > 1) {
38 throw new PhutilArgumentUsageException(
39 pht('Too many arguments: expected one key.'));
43 $use_database = $args->getArg('database');
45 $config = new PhabricatorConfigDatabaseSource('default');
46 $config_type = 'database';
48 $config = new PhabricatorConfigLocalSource();
49 $config_type = 'local';
51 $values = $config->getKeys(array($key));
53 throw new PhutilArgumentUsageException(
55 "Configuration key '%s' is not set in %s configuration!",
61 $config_entry = PhabricatorConfigEntry
::loadConfigEntry($key);
62 $config_entry->setIsDeleted(1);
63 $config_entry->save();
65 $config->deleteKeys(array($key));
70 pht("Deleted '%s' from %s configuration.", $key, $config_type));