Adding check_junk optional support during normalization
Publish PHP Package / docker (push) Successful in 7s
Details
Publish PHP Package / docker (push) Successful in 7s
Details
This commit is contained in:
parent
aa9ff115aa
commit
742e6692d5
|
@ -154,6 +154,7 @@ class ConfigFetchParams
|
||||||
public bool $verbose = false;
|
public bool $verbose = false;
|
||||||
public ?int $max_workers = null;
|
public ?int $max_workers = null;
|
||||||
public bool $touch_files_with_includes = true;
|
public bool $touch_files_with_includes = true;
|
||||||
|
public bool $check_junk = false;
|
||||||
|
|
||||||
function __construct(ConfigGlobals $globals, ConfigScanResult $scanned,
|
function __construct(ConfigGlobals $globals, ConfigScanResult $scanned,
|
||||||
bool $force_stale = false, bool $verbose = false, ?int $max_workers = null)
|
bool $force_stale = false, bool $verbose = false, ?int $max_workers = null)
|
||||||
|
@ -350,7 +351,9 @@ function _config_merge_fetch_results(ConfigFetchParams $params, array $results_b
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _config_invalidate_cache(ConfigFetchParams $params, string $base_dir, string $file, string $cache_file, ?int &$parser_type = null) : ConfigCacheEntry
|
function _config_invalidate_cache(
|
||||||
|
ConfigFetchParams $params, string $base_dir, string $file,
|
||||||
|
string $cache_file, ?int &$parser_type = null) : ConfigCacheEntry
|
||||||
{
|
{
|
||||||
list($conf_id, $conf_strid) = config_ensure_header($base_dir, $file);
|
list($conf_id, $conf_strid) = config_ensure_header($base_dir, $file);
|
||||||
if(!$conf_id)
|
if(!$conf_id)
|
||||||
|
@ -363,14 +366,15 @@ function _config_invalidate_cache(ConfigFetchParams $params, string $base_dir, s
|
||||||
|
|
||||||
$pres = config_parse($params->globals->base_dirs, $file);
|
$pres = config_parse($params->globals->base_dirs, $file);
|
||||||
if($pres->error !== 0)
|
if($pres->error !== 0)
|
||||||
throw new Exception("Error({$pres->error}) while parsing {$file}:\n" . $pres->error_descr);
|
throw new Exception("Parse error({$pres->error}):\n" . $pres->error_descr);
|
||||||
|
|
||||||
$parser_type = $pres->parser_type;
|
$parser_type = $pres->parser_type;
|
||||||
$parsed_arr = $pres->parsed_arr;
|
$parsed_arr = $pres->parsed_arr;
|
||||||
//TODO: these hardcoded keys below probably shouldn't be part of data?
|
//TODO: these hardcoded keys below probably shouldn't be part of data?
|
||||||
$parsed_arr['id'] = $conf_id;
|
$parsed_arr['id'] = $conf_id;
|
||||||
$parsed_arr['strid'] = $conf_strid;
|
$parsed_arr['strid'] = $conf_strid;
|
||||||
list($class, $class_id, $normalized_data) = config_apply_class_normalization($parsed_arr);
|
list($class, $class_id, $normalized_data)
|
||||||
|
= config_apply_class_normalization($parsed_arr, $params->check_junk);
|
||||||
|
|
||||||
$cache_payload_file = config_get_cache_payload_path($params->globals, $file);
|
$cache_payload_file = config_get_cache_payload_path($params->globals, $file);
|
||||||
|
|
||||||
|
|
|
@ -143,11 +143,13 @@ function config_ensure_header(string $conf_dir, string $file, bool $force = fals
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function config_apply_class_normalization(array $kv_data) : array
|
function config_apply_class_normalization(array $kv_data, bool $check_junk = false) : array
|
||||||
{
|
{
|
||||||
$class = $kv_data['class'];
|
$class = $kv_data['class'];
|
||||||
$norm_data = array();
|
$norm_data = array();
|
||||||
call_user_func_array([$class, 'normalize'], array(&$kv_data, &$norm_data));
|
unset($kv_data['class']);
|
||||||
|
call_user_func_array([$class, 'normalize'],
|
||||||
|
array(&$kv_data, &$norm_data, true, $check_junk));
|
||||||
return array($class, $class::CLASS_ID, $norm_data);
|
return array($class, $class::CLASS_ID, $norm_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue