vendor/se7enxweb/legacy-bridge/bundle/EzPublishLegacyBundle.php line 45

Open in your IDE?
  1. <?php
  2. /**
  3. * @copyright Copyright (C) eZ Systems AS. All rights reserved.
  4. * @license For full copyright and license information view LICENSE file distributed with this source code.
  5. */
  6. namespace eZ\Bundle\EzPublishLegacyBundle;
  7. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\ControllerBaseCompatibilityPass;
  8. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\PageServicePass;
  9. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\RememberMeListenerPass;
  10. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\LegacyBundlesPass;
  11. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\LegacySessionPass;
  12. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\RelatedSiteAccessesCleanupPass;
  13. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\RequestIndexListenerPass;
  14. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\RoutingPass;
  15. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\SecurityListenerPass;
  16. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Security\SSOFactory;
  17. use Symfony\Component\DependencyInjection\Compiler\PassConfig;
  18. use Symfony\Component\HttpKernel\Bundle\Bundle;
  19. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\LegacyPass;
  20. use eZ\Bundle\EzPublishLegacyBundle\DependencyInjection\Compiler\TwigPass;
  21. use Symfony\Component\DependencyInjection\ContainerBuilder;
  22. class EzPublishLegacyBundle extends Bundle
  23. {
  24. public function boot()
  25. {
  26. if (!$this->container->getParameter('ezpublish_legacy.enabled')) {
  27. return;
  28. }
  29. $autoload = $this->container->getParameter('ezpublish_legacy.root_dir') . '/autoload.php';
  30. if (!is_file($autoload)) {
  31. return;
  32. }
  33. // Deactivate eZComponents loading from legacy autoload.php as they are already loaded
  34. if (!\defined('EZCBASE_ENABLED')) {
  35. \define('EZCBASE_ENABLED', false);
  36. }
  37. require_once $autoload;
  38. }
  39. public function build(ContainerBuilder $container)
  40. {
  41. parent::build($container);
  42. // Must run before Symfony's ResolveChildDefinitionsPass so ezpublish.controller.base
  43. // exists when child services are resolved on Ibexa 4.x.
  44. $container->addCompilerPass(new ControllerBaseCompatibilityPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10);
  45. $container->addCompilerPass(new RelatedSiteAccessesCleanupPass(), PassConfig::TYPE_OPTIMIZE);
  46. $container->addCompilerPass(new LegacyPass());
  47. $container->addCompilerPass(new TwigPass());
  48. $container->addCompilerPass(new LegacyBundlesPass());
  49. $container->addCompilerPass(new RoutingPass());
  50. $container->addCompilerPass(new LegacySessionPass());
  51. $container->addCompilerPass(new RememberMeListenerPass());
  52. $container->addCompilerPass(new PageServicePass());
  53. $container->addCompilerPass(new RequestIndexListenerPass());
  54. $container->addCompilerPass(new SecurityListenerPass());
  55. /** @var \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension $securityExtension */
  56. $securityExtension = $container->getExtension('security');
  57. $securityExtension->addSecurityListenerFactory(new SSOFactory());
  58. }
  59. }