From 2495b197614d82b99eed6bbec4562078f4429ad7 Mon Sep 17 00:00:00 2001 From: Kevin Decherf Date: Sun, 11 Aug 2019 23:55:12 +0200 Subject: Add default system-wide ignore origin rules with install support Signed-off-by: Kevin Decherf --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/Wallabag/CoreBundle/Command') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 3aa332f1..8d08187a 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -12,6 +12,7 @@ use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; +use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule; use Wallabag\CoreBundle\Entity\InternalSetting; class InstallCommand extends ContainerAwareCommand @@ -277,6 +278,7 @@ class InstallCommand extends ContainerAwareCommand // cleanup before insert new stuff $em->createQuery('DELETE FROM WallabagCoreBundle:InternalSetting')->execute(); + $em->createQuery('DELETE FROM WallabagCoreBundle:IgnoreOriginInstanceRule')->execute(); foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) { $newSetting = new InternalSetting(); @@ -286,6 +288,12 @@ class InstallCommand extends ContainerAwareCommand $em->persist($newSetting); } + foreach ($this->getContainer()->getParameter('wallabag_core.default_ignore_origin_instance_rules') as $ignore_origin_instance_rule) { + $newIgnoreOriginInstanceRule = new IgnoreOriginInstanceRule(); + $newIgnoreOriginInstanceRule->setRule($ignore_origin_instance_rule['rule']); + $em->persist($newIgnoreOriginInstanceRule); + } + $em->flush(); $this->io->text('Config successfully setup.'); -- cgit v1.2.3