Revoke parsing of products index xml file

This commit is contained in:
Björn Fromme
2021-01-21 09:37:11 +01:00
parent cf5e8af576
commit e602bcde74
@@ -146,26 +146,14 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
public function parseXmlFilesForProducts($path)
{
$xmlPath = sprintf('%s/Produkte.xml', $path);
if (!file_exists($xmlPath)) {
$this->logger->error('product list xml not found');
return 0;
}
libxml_use_internal_errors(true);
/** @var \SimpleXMLElement $xmlData */
if (!$xmlData = simplexml_load_string(file_get_contents($xmlPath))) {
libxml_clear_errors();
return 0;
}
$dateCount = 0;
foreach ($xmlData->produkte[0]->children() as $xmlProdukt) {
$busProId = (int)$xmlProdukt->attributes()['id'];
$xmlFile = sprintf('%s/Ziel_%d.xml', $path, $busProId);
$dateCount += $this->parseProductXmlFile($xmlFile);
$folder = opendir($path);
while (($fileName = readdir($folder)) !== false) {
if (strpos($fileName, 'Ziel') === 0) {
$filePath = $path . '/' . $fileName;
$dateCount += $this->parseProductXmlFile($filePath);
}
}
return $dateCount;