diff --git a/src/applications/config/controller/PhabricatorConfigEditController.php b/src/applications/config/controller/PhabricatorConfigEditController.php index 5a6f737ea5..c0753e25f1 100644 --- a/src/applications/config/controller/PhabricatorConfigEditController.php +++ b/src/applications/config/controller/PhabricatorConfigEditController.php @@ -59,7 +59,7 @@ final class PhabricatorConfigEditController $e_value = null; $errors = array(); - if ($request->isFormPost()) { + if ($request->isFormPost() && !$option->getLocked()) { $result = $this->readRequest( $option, @@ -100,6 +100,15 @@ final class PhabricatorConfigEditController $error_view = id(new AphrontErrorView()) ->setTitle(pht('You broke everything!')) ->setErrors($errors); + } else if ($option->getLocked()) { + $msg = pht( + "This configuration is locked and can not be edited from the web ". + "interface."); + + $error_view = id(new AphrontErrorView()) + ->setTitle(pht('Configuration Locked')) + ->setSeverity(AphrontErrorView::SEVERITY_NOTICE) + ->appendChild('

'.phutil_escape_html($msg).'

'); } $control = $this->renderControl( @@ -124,11 +133,15 @@ final class PhabricatorConfigEditController id(new AphrontFormMarkupControl()) ->setLabel(pht('Description')) ->setValue($description)) - ->appendChild($control) - ->appendChild( - id(new AphrontFormSubmitControl()) - ->addCancelButton($done_uri) - ->setValue(pht('Save Config Entry'))); + ->appendChild($control); + + if (!$option->getLocked()) { + $form + ->appendChild( + id(new AphrontFormSubmitControl()) + ->addCancelButton($done_uri) + ->setValue(pht('Save Config Entry'))); + } $examples = $this->renderExamples($option); if ($examples) { @@ -329,6 +342,10 @@ final class PhabricatorConfigEditController ->setValue($display_value) ->setName('value'); + if ($option->getLocked()) { + $control->setDisabled(true); + } + return $control; } diff --git a/src/applications/config/controller/PhabricatorConfigGroupController.php b/src/applications/config/controller/PhabricatorConfigGroupController.php index 0239457729..def0510ca4 100644 --- a/src/applications/config/controller/PhabricatorConfigGroupController.php +++ b/src/applications/config/controller/PhabricatorConfigGroupController.php @@ -91,6 +91,10 @@ final class PhabricatorConfigGroupController $item->addIcon('edit-grey', pht('Default')); } + if ($option->getLocked()) { + $item->addIcon('lock', pht('Locked')); + } + $list->addItem($item); } diff --git a/src/applications/config/option/PhabricatorConfigOption.php b/src/applications/config/option/PhabricatorConfigOption.php index c7673001bf..7827626e36 100644 --- a/src/applications/config/option/PhabricatorConfigOption.php +++ b/src/applications/config/option/PhabricatorConfigOption.php @@ -12,6 +12,16 @@ final class PhabricatorConfigOption private $options; private $group; private $examples; + private $locked; + + public function setLocked($locked) { + $this->locked = $locked; + return $this; + } + + public function getLocked() { + return $this->locked; + } public function addExample($value, $description) { $this->examples[] = array($value, $description); diff --git a/src/applications/config/option/PhabricatorCoreConfigOptions.php b/src/applications/config/option/PhabricatorCoreConfigOptions.php index 301c8b50e6..068dcdbb14 100644 --- a/src/applications/config/option/PhabricatorCoreConfigOptions.php +++ b/src/applications/config/option/PhabricatorCoreConfigOptions.php @@ -66,6 +66,8 @@ final class PhabricatorCoreConfigOptions "traditional UI strings like 'Submit', you can set this flag to ". "disable most of the jokes and easter eggs.")), $this->newOption('storage.default-namespace', 'string', 'phabricator') + // NOTE: Lock this, since editing it from the web torpedoes an install. + ->setLocked(true) ->setSummary( pht("The namespace that Phabricator databases should use.")) ->setDescription( @@ -75,8 +77,7 @@ final class PhabricatorCoreConfigOptions "named 'phabricator_differential' by default. You can change ". "this namespace if you want. Normally, you should not do this ". "unless you are developing Phabricator and using namespaces to ". - "separate multiple sandbox datasets.")) - ->addExample('phabricator', 'Valid Setting'), + "separate multiple sandbox datasets.")), $this->newOption('environment.append-paths', 'list', null) ->setSummary( pht("These paths get appended to your \$PATH envrionment variable."))