Differential D18166 Diff 43699 src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php
Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php
- This file was moved from src/infrastructure/cluster/config/PhabricatorClusterSearchConfigOptionType.php.
<?php | <?php | ||||
final class PhabricatorClusterSearchConfigOptionType | final class PhabricatorClusterSearchConfigType | ||||
extends PhabricatorConfigJSONOptionType { | extends PhabricatorJSONConfigType { | ||||
public function validateOption(PhabricatorConfigOption $option, $value) { | const TYPEKEY = 'cluster.search'; | ||||
public function validateStoredValue( | |||||
PhabricatorConfigOption $option, | |||||
$value) { | |||||
self::validateValue($value); | self::validateValue($value); | ||||
} | } | ||||
public static function validateValue($value) { | public static function validateValue($value) { | ||||
if (!is_array($value)) { | |||||
throw new Exception( | |||||
pht( | |||||
'Search cluster configuration is not valid: value must be a '. | |||||
'list of search hosts.')); | |||||
} | |||||
$engines = PhabricatorSearchService::loadAllFulltextStorageEngines(); | $engines = PhabricatorSearchService::loadAllFulltextStorageEngines(); | ||||
foreach ($value as $index => $spec) { | foreach ($value as $index => $spec) { | ||||
if (!is_array($spec)) { | if (!is_array($spec)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Search cluster configuration is not valid: each entry in the '. | 'Search cluster configuration is not valid: each entry in the '. | ||||
'list must be a dictionary describing a search service, but '. | 'list must be a dictionary describing a search service, but '. | ||||
▲ Show 20 Lines • Show All 59 Lines • Show Last 20 Lines |