debut d'un system d'execution de command à la volet

This commit is contained in:
afornerot 2020-04-22 11:33:42 +02:00
parent 9c0b1b3280
commit 9b5aae23b2
3 changed files with 12 additions and 3 deletions

View File

@ -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('<fg=red>'.$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");
}
}

View File

@ -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');

View File

@ -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');