mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2026-01-01 11:19:34 -05:00
parent
60d043cb18
commit
2023cae041
1 changed files with 19 additions and 1 deletions
|
|
@ -67,12 +67,18 @@ class LegacyConfigParser
|
|||
{
|
||||
Benchmark::measure('Loading BP config from file: ' . $name);
|
||||
$parser = new static($name);
|
||||
|
||||
$config = $parser->getParsedConfig();
|
||||
$config->setMetadata(
|
||||
static::readMetadataFromString($name, $string)
|
||||
);
|
||||
|
||||
foreach (preg_split('/\n/', $string) as $line) {
|
||||
$parser->parseLine($line);
|
||||
}
|
||||
|
||||
Benchmark::measure('Business process ' . $name . ' loaded');
|
||||
return $parser->getParsedConfig();
|
||||
return $config;
|
||||
}
|
||||
|
||||
protected function reallyParseFile($filename)
|
||||
|
|
@ -112,6 +118,18 @@ class LegacyConfigParser
|
|||
return $metadata;
|
||||
}
|
||||
|
||||
public static function readMetadataFromString($name, & $string)
|
||||
{
|
||||
$metadata = new Metadata($name);
|
||||
|
||||
$lines = preg_split('/\r?\n/', substr($string, 0, 8092));
|
||||
foreach ($lines as $line) {
|
||||
static::parseHeaderLine($line, $metadata);
|
||||
}
|
||||
|
||||
return $metadata;
|
||||
}
|
||||
|
||||
protected function splitCommaSeparated($string)
|
||||
{
|
||||
return preg_split('/\s*,\s*/', $string, -1, PREG_SPLIT_NO_EMPTY);
|
||||
|
|
|
|||
Loading…
Reference in a new issue