diff --git a/src/CustomElements.php b/src/CustomElements.php index a2f9a5b..7fe0183 100644 --- a/src/CustomElements.php +++ b/src/CustomElements.php @@ -1393,6 +1393,7 @@ function ($count) { } } + $saveToCache = true; $elements = array(); foreach ($templates as $template => $label) { @@ -1422,7 +1423,19 @@ function ($count) { } } - $config = include $configPath; + try { + $config = include $configPath; + } + catch (\Throwable $exception) { + $request = System::getContainer()->get('request_stack')->getCurrentRequest(); + + if ($request && $request->get('_route') === 'contao_install') { + $saveToCache = false; + continue; + } + + throw $exception; + } $element = array( 'config' => $config, @@ -1521,6 +1534,10 @@ function ($count) { } + if (!$saveToCache) { + return; + } + $file = new \File($filePaths['path'], true); $file->write(implode("\n", $contents)); $file->close();