From 124f6fb738a75c4cdbad6a9be58fd3ad7d407519 Mon Sep 17 00:00:00 2001 From: afornerot Date: Mon, 24 Feb 2020 09:41:53 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20script=20forcer=20flag=20visible=20?= =?UTF-8?q?=C3=A0=20true=20(ref=20#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CoreBundle/Command/ScriptCommand.php | 84 ++++++++++++++++++ .../CoreBundle/Command/data/core-init-01.sql | 2 +- .../Resources/public/themes/transnum/look.png | Bin 27748 -> 27748 bytes .../public/themes/transnum/transnum-logo.png | Bin 27748 -> 27748 bytes 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php new file mode 100644 index 00000000..a191f802 --- /dev/null +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/ScriptCommand.php @@ -0,0 +1,84 @@ +setName('Core:Script') + ->setDescription('Lauch Script') + ->setHelp('Execeute some script : visibletrue / ') + ->addArgument('scriptname', InputArgument::OPTIONAL, 'scriptname') + ; + } + + 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/"; + + $this->writelnred(''); + $this->writelnred('== Core:Script'); + $this->writelnred('=========================================================================================================='); + + $scriptname = $input->getArgument('scriptname'); + $this->writeln($scriptname); + + switch($scriptname) { + case "visibletrue": $this->visibletrue(); break; + } + + $this->writeln(''); + return 1; + } + + private function visibletrue() { + $users = $this->em->getRepository('CadolesCoreBundle:User')->findAll(); + foreach($users as $user) { + if(!$user->getVisible()) { + $this->writeln($user->getUsername()); + + $user->setVisible(true); + $this->em->persist($user); + $this->em->flush(); + } + } + } + + 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/src/Cadoles/CoreBundle/Command/data/core-init-01.sql b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/data/core-init-01.sql index a2830923..63bad02c 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}BkFFVAICIt3FUlHQLN1FsNWUtsPnLFRs +(-100, -100, 'admin', 'Administrateur', 'draaf', '{SSHA}S0E51VgU0ZRXsD5jEdnUDeBkwBRO+29r ', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN', '130007107', 'simple'); diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png b/src/ninegate-1.0/src/Cadoles/CoreBundle/Resources/public/themes/transnum/look.png index e0f7c73fc5e1194063cd18940ad6de6a2deafb7b..0b2ee11317895db4d0589bf51661809eec85fee6 100644 GIT binary patch delta 23 fcmaEIgYn4?#tqj@Ie585MP3G