Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/ferret/function/FerretSearchFunction.php
Show All 11 Lines | abstract class FerretSearchFunction | ||||
} | } | ||||
final public static function validateFerretFunctionName($function_name) { | final public static function validateFerretFunctionName($function_name) { | ||||
if (!preg_match('/^[a-zA-Z-]+\z/', $function_name)) { | if (!preg_match('/^[a-zA-Z-]+\z/', $function_name)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Ferret search engine function name ("%s") is invalid. Function '. | 'Ferret search engine function name ("%s") is invalid. Function '. | ||||
'names must be nonempty and may only contain latin letters and '. | 'names must be nonempty and may only contain latin letters and '. | ||||
'hyphens.')); | 'hyphens.', | ||||
$function_name)); | |||||
} | } | ||||
} | } | ||||
final public static function validateFerretFunctionFieldKey($field_key) { | final public static function validateFerretFunctionFieldKey($field_key) { | ||||
if (!preg_match('/^[a-z]{4}\z/', $field_key)) { | if (!preg_match('/^[a-z]{4}\z/', $field_key)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Ferret search engine field key ("%s") is invalid. Field keys '. | 'Ferret search engine field key ("%s") is invalid. Field keys '. | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | foreach ($extensions as $extension) { | ||||
$normal_name = self::getNormalizedFunctionName( | $normal_name = self::getNormalizedFunctionName( | ||||
$function_name); | $function_name); | ||||
if ($normal_name !== $function_name) { | if ($normal_name !== $function_name) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Ferret function "%s" is specified with a denormalized name. '. | 'Ferret function "%s" is specified with a denormalized name. '. | ||||
'Instead, specify the function using the normalized '. | 'Instead, specify the function using the normalized '. | ||||
'function name ("%s").', | 'function name ("%s").', | ||||
$function_name, | |||||
$normal_name)); | $normal_name)); | ||||
} | } | ||||
if (isset($function_map[$function_name])) { | if (isset($function_map[$function_name])) { | ||||
$other_extension = $function_map[$function_name]; | $other_extension = $function_map[$function_name]; | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Two different fulltext engine extensions ("%s" and "%s") '. | 'Two different fulltext engine extensions ("%s" and "%s") '. | ||||
Show All 35 Lines |