fix flt_class

This commit is contained in:
Madpwnhammer 2023-09-25 16:55:12 +03:00
parent 6252899428
commit 40b2db3e50
1 changed files with 8 additions and 12 deletions

View File

@ -86,18 +86,14 @@ function flt_class($val, $name, $struct, $args)
$conf_path = \taskman\config_real_path($conf_path);
$lines = file($conf_path);
foreach($lines as $line)
{
if(preg_match('~"?class"?\s*:\s*"([^"]+)"~', $line, $matches))
{
$conf_class = $matches[1];
if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0]))
throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child");
else
return $val;
}
}
$cce = \taskman\config_fetch_by_path($conf_path);
$conf_class = $cce->class;
if($conf_class != $args[0] && !is_subclass_of($conf_class, $args[0]))
throw new Exception($val.". Config class is \"".$conf_class."\". Must be \"".$args[0]."\" or it's child");
else
return $val;
throw new Exception($val.". Config class is not found in '$conf_path'");
}