. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "EspoCRM" word. ************************************************************************/ use Espo\Core\Container; use Espo\Core\InjectableFactory; use Espo\Core\Utils\Config; use Espo\Core\Utils\Config\ConfigWriter; use Espo\Core\Utils\Metadata; use Espo\Entities\Template; use Espo\ORM\EntityManager; use Espo\Tools\Pdf\Template as PdfTemplate; /** @noinspection PhpMultipleClassDeclarationsInspection */ class AfterUpgrade { public function run(Container $container): void { $configWriter = $container->getByClass(InjectableFactory::class) ->create(ConfigWriter::class); $configWriter->setMultiple([ 'jobForceUtc' => true, ]); $configWriter->save(); $em = $container->getByClass(EntityManager::class); $config = $container->getByClass(Config::class); $this->updateTemplates($em, $config); $this->updateTargetList($container->getByClass(Metadata::class)); } private function updateTemplates(EntityManager $entityManager, Config $config): void { if ($config->get('pdfEngine') !== 'Dompdf') { return; } /** @var iterable