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

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 Webmozart\PathUtil\Path;
  14. /**
  15.  * @internal
  16.  */
  17. class InitializeApplicationListener
  18. {
  19.     /**
  20.      * @var string
  21.      */
  22.     private $projectDir;
  23.     public function __construct(string $projectDir)
  24.     {
  25.         $this->projectDir $projectDir;
  26.     }
  27.     /**
  28.      * Adds the initialize.php file.
  29.      */
  30.     public function __invoke(InitializeApplicationEvent $event): void
  31.     {
  32.         $filesystem = new Filesystem();
  33.         $targetPath Path::join($this->projectDir'system/initialize.php');
  34.         if ($filesystem->exists($targetPath)) {
  35.             return;
  36.         }
  37.         $filesystem->copy(__DIR__.'/../Resources/skeleton/system/initialize.php'$targetPathtrue);
  38.     }
  39. }