@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.

Soften a possible cluster search setup fatal

Summary:
Ref T12450. The way that config repair and setup issues interact is kind of complicated, and if `cluster.search` is invalid we may end up using `cluster.search` before we repair it.

I poked at things for a bit but wasn't confident I could get it to consistently repair before we use it without doing a big messy change.

The only thing that really matters is whether "type" is valid or not, so just put a slightly softer/more-tailored check in for that.

Test Plan:
- With `"type": "elastic"`, loaded setup issues.
- Before patch: hard fatal.
- After patch: softer fatal with more useful messaging.

{F4321048}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12450

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

+13 -1
+1 -1
src/infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php
··· 4 4 extends PhabricatorConfigJSONOptionType { 5 5 6 6 public function validateOption(PhabricatorConfigOption $option, $value) { 7 - self::validateClusterSearchConfigValue($value); 7 + self::validateValue($value); 8 8 } 9 9 10 10 public static function validateValue($value) {
+12
src/infrastructure/cluster/search/PhabricatorSearchService.php
··· 186 186 $refs = array(); 187 187 188 188 foreach ($services as $config) { 189 + 190 + // Normally, we've validated configuration before we get this far, but 191 + // make sure we don't fatal if we end up here with a bogus configuration. 192 + if (!isset($engines[$config['type']])) { 193 + throw new Exception( 194 + pht( 195 + 'Configured search engine type "%s" is unknown. Valid engines '. 196 + 'are: %s.', 197 + $config['type'], 198 + implode(', ', array_keys($engines)))); 199 + } 200 + 189 201 $engine = $engines[$config['type']]; 190 202 $cluster = new self($engine); 191 203 $cluster->setConfig($config);