vendor/contao/manager-bundle/src/EventListener/InitializeApplicationListener.php line 34

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of Contao.
  5. *
  6. * (c) Leo Feyer
  7. *
  8. * @license LGPL-3.0-or-later
  9. */
  10. namespace Contao\ManagerBundle\EventListener;
  11. use Contao\InstallationBundle\Event\InitializeApplicationEvent;
  12. use Symfony\Component\Filesystem\Filesystem;
  13. use Symfony\Component\Filesystem\Path;
  14. /**
  15. * @internal
  16. */
  17. class InitializeApplicationListener
  18. {
  19. private string $projectDir;
  20. public function __construct(string $projectDir)
  21. {
  22. $this->projectDir = $projectDir;
  23. }
  24. /**
  25. * Adds the initialize.php file.
  26. */
  27. public function __invoke(InitializeApplicationEvent $event): void
  28. {
  29. $filesystem = new Filesystem();
  30. $targetPath = Path::join($this->projectDir, 'system/initialize.php');
  31. if ($filesystem->exists($targetPath)) {
  32. return;
  33. }
  34. $filesystem->copy(__DIR__.'/../Resources/skeleton/system/initialize.php', $targetPath, true);
  35. }
  36. }