From 9b5aae23b2c6292f056f1830ba1fbb5cc498aedc Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 22 Apr 2020 11:33:42 +0200 Subject: [PATCH] =?UTF-8?q?debut=20d'un=20system=20d'execution=20de=20comm?= =?UTF-8?q?and=20=C3=A0=20la=20volet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Cadoles/CoreBundle/Command/PurgeFileCommand.php | 11 ++++++++++- .../Cadoles/CoreBundle/Command/data/core-init-01.sql | 2 +- .../src/Cadoles/CronBundle/Command/MailCommand.php | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php index 1d8a5c25..8f449b4e 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php @@ -22,6 +22,7 @@ class PurgeFileCommand extends Command private $output; private $filesystem; private $rootlog; + private $byexec; protected function configure() { @@ -30,7 +31,8 @@ class PurgeFileCommand extends Command ->setDescription('Purge Files') ->setHelp('This command Purge the obsolete Files') ->addArgument('cronid', InputArgument::OPTIONAL, 'ID Cron Job') - ->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron') + ->addArgument('lastchance', InputArgument::OPTIONAL, 'Lastchance to run the cron') + ->addArgument('byexec', InputArgument::OPTIONAL, 'By Cron:Exec') ; } @@ -43,6 +45,11 @@ class PurgeFileCommand extends Command $this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; $alias = $this->container->getParameter('alias'); + // Le script est-il executé via Cron:Exec + $this->byexec = $input->getArgument('byexec'); + if($this->byexec=="") $this->byexec=false; + echo "pouet".$this->byexec; + $this->writelnred(''); $this->writelnred('== Core:PurgeFile'); $this->writelnred('=========================================================================================================='); @@ -368,9 +375,11 @@ class PurgeFileCommand extends Command private function writelnred($string) { $this->output->writeln(''.$string.''); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n"); } private function writeln($string) { $this->output->writeln($string); $this->filesystem->appendToFile($this->rootlog.'cron.log', $string."\n"); + if($this->byexec) $this->filesystem->appendToFile($this->rootlog.'exec.log', $string."\n"); } } diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index 11341265..305f304a 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql @@ -8,7 +8,7 @@ INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES (-100, 'DRAAF', '130007107'); INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES -(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}9tH17tlC86xamslwYLnhF4qiMaQqvbuL +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}qrzhXan0+OWTmbHaEIPKrny4REUw0YhM ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); diff --git a/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php b/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php index 352431fb..ec395e55 100644 --- a/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CronBundle/Command/MailCommand.php @@ -42,7 +42,7 @@ class MailCommand extends ContainerAwareCommand $this->filesystem = new Filesystem(); $this->rootlog = $this->container->get('kernel')->getRootDir()."/../var/logs/"; - $mailer_host = $this->getContainer()->getParameter('cron_activate'); + $mailer_host = $this->getContainer()->getParameter('mailer_host'); $this->writelnred(''); $this->writelnred('== Cron:Mail');