Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15408682
D20711.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D20711.diff
View Options
diff --git a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
--- a/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
+++ b/src/applications/config/management/PhabricatorConfigManagementSetWorkflow.php
@@ -30,11 +30,10 @@
}
public function execute(PhutilArgumentParser $args) {
- $console = PhutilConsole::getConsole();
$argv = $args->getArg('args');
- if (count($argv) == 0) {
+ if (!$argv) {
throw new PhutilArgumentUsageException(
- pht('Specify a configuration key and a value to set it to.'));
+ pht('Specify the configuration key you want to set.'));
}
$is_stdin = $args->getArg('stdin');
@@ -45,7 +44,8 @@
if (count($argv) > 1) {
throw new PhutilArgumentUsageException(
pht(
- 'Too many arguments: expected only a key when using "--stdin".'));
+ 'Too many arguments: expected only a configuration key when '.
+ 'using "--stdin".'));
}
fprintf(STDERR, tsprintf("%s\n", pht('Reading value from stdin...')));
@@ -54,7 +54,8 @@
if (count($argv) == 1) {
throw new PhutilArgumentUsageException(
pht(
- "Specify a value to set the key '%s' to.",
+ 'Specify a value to set the configuration key "%s" to, or '.
+ 'use "--stdin" to read a value from stdin.',
$key));
}
@@ -67,14 +68,13 @@
$value = $argv[1];
}
-
$options = PhabricatorApplicationConfigOptions::loadAllOptions();
if (empty($options[$key])) {
throw new PhutilArgumentUsageException(
pht(
- "No such configuration key '%s'! Use `%s` to list all keys.",
- $key,
- 'config list'));
+ 'Configuration key "%s" is unknown. Use "bin/config list" to list '.
+ 'all known keys.',
+ $key));
}
$option = $options[$key];
@@ -99,7 +99,7 @@
switch ($type) {
default:
$message = pht(
- 'Config key "%s" is of type "%s". Specify it in JSON.',
+ 'Configuration key "%s" is of type "%s". Specify it in JSON.',
$key,
$type);
break;
@@ -128,7 +128,6 @@
}
if ($use_database) {
- $config_type = 'database';
$config_entry = PhabricatorConfigEntry::loadConfigEntry($key);
$config_entry->setValue($value);
@@ -136,15 +135,28 @@
$config_entry->setIsDeleted(0);
$config_entry->save();
+
+ $write_message = pht(
+ 'Wrote configuration key "%s" to database storage.',
+ $key);
} else {
- $config_type = 'local';
- id(new PhabricatorConfigLocalSource())
+ $config_source = id(new PhabricatorConfigLocalSource())
->setKeys(array($key => $value));
+
+ $local_path = $config_source->getReadablePath();
+
+ $write_message = pht(
+ 'Wrote configuration key "%s" to local storage (in file "%s").',
+ $key,
+ $local_path);
}
- $console->writeOut(
- "%s\n",
- pht("Set '%s' in %s configuration.", $key, $config_type));
+ echo tsprintf(
+ "<bg:green>** %s **</bg> %s\n",
+ pht('DONE'),
+ $write_message);
+
+ return 0;
}
}
diff --git a/src/infrastructure/env/PhabricatorConfigLocalSource.php b/src/infrastructure/env/PhabricatorConfigLocalSource.php
--- a/src/infrastructure/env/PhabricatorConfigLocalSource.php
+++ b/src/infrastructure/env/PhabricatorConfigLocalSource.php
@@ -65,4 +65,9 @@
return $path;
}
+ public function getReadablePath() {
+ $path = $this->getConfigPath();
+ return Filesystem::readablePath($path);
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 12:47 AM (2 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7712249
Default Alt Text
D20711.diff (3 KB)
Attached To
Mode
D20711: Make the success message from "bin/config" more clear
Attached
Detach File
Event Timeline
Log In to Comment