@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Read default values of custom config options

Summary: Because the Default configuration provider is loaded before custom libraries, any config options specified in them don't get a default values.

Test Plan: Looked at /config/

Reviewers: epriestley, codeblock, btrahan

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4532

authored by

Asher Baker and committed by
epriestley
da9315b1 ff53b794

+21 -6
+7 -3
src/applications/config/option/PhabricatorApplicationConfigOptions.php
··· 132 132 ->setGroup($this); 133 133 } 134 134 135 - final public static function loadAll() { 135 + final public static function loadAll($external_only = false) { 136 136 $symbols = id(new PhutilSymbolLoader()) 137 137 ->setAncestorClass('PhabricatorApplicationConfigOptions') 138 138 ->setConcreteOnly(true) ··· 140 140 141 141 $groups = array(); 142 142 foreach ($symbols as $symbol) { 143 + if ($external_only && $symbol['library'] == 'phabricator') { 144 + continue; 145 + } 146 + 143 147 $obj = newv($symbol['name'], array()); 144 148 $key = $obj->getKey(); 145 149 if (isset($groups[$key])) { ··· 156 160 return $groups; 157 161 } 158 162 159 - final public static function loadAllOptions() { 160 - $groups = self::loadAll(); 163 + final public static function loadAllOptions($external_only = false) { 164 + $groups = self::loadAll($external_only); 161 165 162 166 $options = array(); 163 167 foreach ($groups as $group) {
+6
src/infrastructure/env/PhabricatorConfigDefaultSource.php
··· 13 13 $this->setSource(new PhabricatorConfigDictionarySource($options)); 14 14 } 15 15 16 + public function loadExternalOptions() { 17 + $options = PhabricatorApplicationConfigOptions::loadAllOptions(true); 18 + $options = mpull($options, 'getDefault'); 19 + $this->setKeys($options); 20 + } 21 + 16 22 }
+8 -3
src/infrastructure/env/PhabricatorEnv.php
··· 132 132 $stack = new PhabricatorConfigStackSource(); 133 133 self::$sourceStack = $stack; 134 134 135 - $stack->pushSource( 136 - id(new PhabricatorConfigDefaultSource()) 137 - ->setName(pht('Global Default'))); 135 + $defaultSource = id(new PhabricatorConfigDefaultSource()) 136 + ->setName(pht('Global Default')); 137 + $stack->pushSource($defaultSource); 138 138 139 139 $env = self::getSelectedEnvironmentName(); 140 140 $stack->pushSource( ··· 151 151 foreach (PhabricatorEnv::getEnvConfig('load-libraries') as $library) { 152 152 phutil_load_library($library); 153 153 } 154 + 155 + // If custom libraries specify config options, they won't get default 156 + // values as the Default source has already been loaded, so we get it to 157 + // pull in all options from non-phabricator libraries now they are loaded. 158 + $defaultSource->loadExternalOptions(); 154 159 155 160 try { 156 161 $stack->pushSource(