From dbade2fce45e8ccef2793534016197bcaab90f39 Mon Sep 17 00:00:00 2001 From: afornerot Date: Fri, 26 Mar 2021 09:26:52 +0100 Subject: [PATCH] mise en place d'un systeme de commande local --- src/ninegate-1.0/.gitignore | 1 + src/ninegate-1.0/scripts/LocalCommand.php | 46 +++++++++++++++++++ .../scripts/ninegate-postservice-01.sh | 8 ++++ 3 files changed, 55 insertions(+) create mode 100644 src/ninegate-1.0/scripts/LocalCommand.php diff --git a/src/ninegate-1.0/.gitignore b/src/ninegate-1.0/.gitignore index 77814bb3..de346708 100644 --- a/src/ninegate-1.0/.gitignore +++ b/src/ninegate-1.0/.gitignore @@ -2,6 +2,7 @@ /app/config/parameters.yml /app/config/template.yml /src/Cadoles/CoreBundle/Command/data/core-init-01.sql +/src/Cadoles/CoreBundle/Command/LocalCommand.php /build/ /phpunit.xml /var/* diff --git a/src/ninegate-1.0/scripts/LocalCommand.php b/src/ninegate-1.0/scripts/LocalCommand.php new file mode 100644 index 00000000..aff7ca55 --- /dev/null +++ b/src/ninegate-1.0/scripts/LocalCommand.php @@ -0,0 +1,46 @@ +setName('Core:Local') + ->setDescription('Lauch Local Script') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $this->container = $this->getApplication()->getKernel()->getContainer(); + $this->em = $this->container->get('doctrine')->getEntityManager(); + $this->output = $output; + $this->filesystem = new Filesystem(); + $this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; + + return 1; + } + + + private function writelnred($string) { + $this->output->writeln(''.$string.''); + $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + } + private function writeln($string) { + $this->output->writeln($string); + $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + } +} diff --git a/src/ninegate-1.0/scripts/ninegate-postservice-01.sh b/src/ninegate-1.0/scripts/ninegate-postservice-01.sh index 3eccd8df..af996e91 100755 --- a/src/ninegate-1.0/scripts/ninegate-postservice-01.sh +++ b/src/ninegate-1.0/scripts/ninegate-postservice-01.sh @@ -49,6 +49,11 @@ rm -f /var/www/html/ninegate/var/logs/dev.log # Copie des polices du projet dans le rep web cp -rf src/Cadoles/CoreBundle/Resources/public/fonts web/ +# Copie de la commande local de base si elle la commande n'existe pas +if [ ! -f src/Cadoles/CoreBundle/Command/LocalCommand.php ]; then + cp -rf scripts/LocalCommand.php src/Cadoles/CoreBundle/Command/LocalCommand.php +fi + # Nettoyage du cache echo echo CACHE = Refresh @@ -66,6 +71,9 @@ php bin/console Portal:InitData --env=prod # Passage des scripts php bin/console Core:Script --env=prod +# Passage des scripts locaux +php bin/console Core:Local --env=prod + # Generation des assets echo ASSET = Dump bin/console assetic:dump --env=prod --quiet