diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -94,7 +94,14 @@ } } } else { - $display_value = $this->getDisplayValue($option, $config_entry); + if ($config_entry->getIsDeleted()) { + $display_value = null; + } else { + $display_value = $this->getDisplayValue( + $option, + $config_entry, + $config_entry->getValue()); + } } $form = new AphrontFormView(); @@ -186,7 +193,7 @@ $form->appendChild( id(new AphrontFormMarkupControl()) ->setLabel(pht('Default')) - ->setValue($this->renderDefaults($option))); + ->setValue($this->renderDefaults($option, $config_entry))); } $title = pht('Edit %s', $this->key); @@ -348,17 +355,16 @@ private function getDisplayValue( PhabricatorConfigOption $option, - PhabricatorConfigEntry $entry) { - - if ($entry->getIsDeleted()) { - return null; - } + PhabricatorConfigEntry $entry, + $value) { if ($option->isCustomType()) { - return $option->getCustomObject()->getDisplayValue($option, $entry); + return $option->getCustomObject()->getDisplayValue( + $option, + $entry, + $value); } else { $type = $option->getType(); - $value = $entry->getValue(); switch ($type) { case 'int': case 'string': @@ -497,7 +503,10 @@ $table); } - private function renderDefaults(PhabricatorConfigOption $option) { + private function renderDefaults( + PhabricatorConfigOption $option, + PhabricatorConfigEntry $entry) { + $stack = PhabricatorEnv::getConfigSourceStack(); $stack = $stack->getStack(); @@ -515,7 +524,9 @@ if (!array_key_exists($option->getKey(), $value)) { $value = phutil_tag('em', array(), pht('(empty)')); } else { - $value = PhabricatorConfigJSON::prettyPrintJSON( + $value = $this->getDisplayValue( + $option, + $entry, $value[$option->getKey()]); } diff --git a/src/applications/config/custom/PhabricatorConfigJSONOptionType.php b/src/applications/config/custom/PhabricatorConfigJSONOptionType.php --- a/src/applications/config/custom/PhabricatorConfigJSONOptionType.php +++ b/src/applications/config/custom/PhabricatorConfigJSONOptionType.php @@ -34,18 +34,6 @@ return array($e_value, $errors, $storage_value, $display_value); } - public function getDisplayValue( - PhabricatorConfigOption $option, - PhabricatorConfigEntry $entry) { - $value = $entry->getValue(); - if (!$value) { - return ''; - } - - $json = new PhutilJSON(); - return $json->encodeFormatted($value); - } - public function renderControl( PhabricatorConfigOption $option, $display_value, diff --git a/src/applications/config/custom/PhabricatorConfigOptionType.php b/src/applications/config/custom/PhabricatorConfigOptionType.php --- a/src/applications/config/custom/PhabricatorConfigOptionType.php +++ b/src/applications/config/custom/PhabricatorConfigOptionType.php @@ -20,8 +20,16 @@ public function getDisplayValue( PhabricatorConfigOption $option, - PhabricatorConfigEntry $entry) { - return $entry->getValue(); + PhabricatorConfigEntry $entry, + $value) { + + if (is_array($value)) { + $json = new PhutilJSON(); + return $json->encodeFormatted($value); + } else { + return $value; + } + } public function renderControl( diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -59,8 +59,8 @@ "won't work. The major use case for this is moving installs ". "across domains.")) ->addExample( - '["http://phabricator2.example.com/", '. - '"http://phabricator3.example.com/"]', + "http://phabricator2.example.com/\n". + "http://phabricator3.example.com/", pht('Valid Setting')), $this->newOption('phabricator.timezone', 'string', null) ->setSummary( diff --git a/src/applications/config/option/PhabricatorSecurityConfigOptions.php b/src/applications/config/option/PhabricatorSecurityConfigOptions.php --- a/src/applications/config/option/PhabricatorSecurityConfigOptions.php +++ b/src/applications/config/option/PhabricatorSecurityConfigOptions.php @@ -124,8 +124,7 @@ "automatically linked if the protocol appears in this set. This ". "whitelist is primarily to prevent security issues like ". "javascript:// URIs.")) - ->addExample( - '{"http": true, "https": true"}', pht('Valid Setting')) + ->addExample("http\nhttps", pht('Valid Setting')) ->setLocked(true), $this->newOption( 'uri.allowed-editor-protocols', diff --git a/src/infrastructure/celerity/management/CelerityManagementMapWorkflow.php b/src/infrastructure/celerity/management/CelerityManagementMapWorkflow.php --- a/src/infrastructure/celerity/management/CelerityManagementMapWorkflow.php +++ b/src/infrastructure/celerity/management/CelerityManagementMapWorkflow.php @@ -196,7 +196,7 @@ * * @param string Resource name. * @param string Resource data. - * @return pair|nul> The `@provides` symbol and the + * @return pair|null> The `@provides` symbol and the * list of `@requires` symbols. If the resource is not part of the * dependency graph, both are null. */