vendor/contao/manager-bundle/src/EventListener/InstallCommandListener.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\CoreBundle\Command\InstallCommand;
  12. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  13. use Symfony\Component\Filesystem\Filesystem;
  14. /**
  15.  * @internal
  16.  */
  17. class InstallCommandListener
  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(ConsoleTerminateEvent $event): void
  31.     {
  32.         if (!$event->getCommand() instanceof InstallCommand) {
  33.             return;
  34.         }
  35.         (new Filesystem())
  36.             ->copy(
  37.                 __DIR__.'/../Resources/skeleton/system/initialize.php',
  38.                 $this->projectDir.'/system/initialize.php',
  39.                 true
  40.             )
  41.         ;
  42.     }
  43. }