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

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