Improve failure tolerance of contingent import service

This commit is contained in:
Björn Fromme
2021-08-28 09:59:38 +02:00
parent cdd3266f3f
commit 856dbe81d8
@@ -143,6 +143,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
public function loadXmlFile($file): ?\SimpleXMLElement
{
libxml_use_internal_errors (true);
if (!file_exists($file)) {
return null;
}
/** @var \SimpleXMLElement $xmlData */
if (!$xmlData = simplexml_load_string(file_get_contents($file))) {
libxml_clear_errors();
@@ -210,7 +213,9 @@ class ContingentImportService implements SingletonInterface, LoggerAwareInterfac
if ($xmlContingent->idbuspro_kontingent_aus) {
$linkedProductId = (int)$xmlContingent->idbuspro_kontingent_aus;
$path = GeneralUtility::getFileAbsFileName(self::XML_PATH);
$xmlContingent = $this->loadXmlFile(sprintf('%s/HotelZimmer_%d.xml', $path, $linkedProductId));
if (null === $xmlContingent = $this->loadXmlFile(sprintf('%s/HotelZimmer_%d.xml', $path, $linkedProductId))) {
return 0;
}
}
if (empty($xmlContingent->kapazitaeten)) {