From 3af6f3fa724f15f49e798c195bdf11a9e5dfedca Mon Sep 17 00:00:00 2001 From: Michal Kierat Date: Mon, 18 May 2015 13:24:11 +0100 Subject: [PATCH 1/2] Allow passing in APP_INCLUDE to php-resque --- Command/StartScheduledWorkerCommand.php | 5 ++++- Command/StartWorkerCommand.php | 5 ++++- DependencyInjection/BCCResqueExtension.php | 1 + DependencyInjection/Configuration.php | 5 +++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Command/StartScheduledWorkerCommand.php b/Command/StartScheduledWorkerCommand.php index acb6da5..30ef03f 100644 --- a/Command/StartScheduledWorkerCommand.php +++ b/Command/StartScheduledWorkerCommand.php @@ -33,11 +33,14 @@ protected function execute(InputInterface $input, OutputInterface $output) } $env = array( - 'APP_INCLUDE' => $this->getContainer()->getParameter('kernel.root_dir').'/bootstrap.php.cache', + 'APP_INCLUDE' => $this->getContainer()->getParameter('bcc_resque.resque.app_include'), 'VVERBOSE' => 1, 'RESQUE_PHP' => $this->getContainer()->getParameter('bcc_resque.resque.vendor_dir').'/chrisboulton/php-resque/lib/Resque.php', 'INTERVAL' => $input->getOption('interval'), ); + if (false !== getenv('APP_INCLUDE')) { + $env['APP_INCLUDE'] = getenv('APP_INCLUDE'); + } $prefix = $this->getContainer()->getParameter('bcc_resque.prefix'); if (!empty($prefix)) { diff --git a/Command/StartWorkerCommand.php b/Command/StartWorkerCommand.php index 916c519..ee1f454 100644 --- a/Command/StartWorkerCommand.php +++ b/Command/StartWorkerCommand.php @@ -41,7 +41,10 @@ protected function execute(InputInterface $input, OutputInterface $output) ); } - $env['APP_INCLUDE'] = $this->getContainer()->getParameter('kernel.root_dir').'/bootstrap.php.cache'; + $env['APP_INCLUDE'] = $this->getContainer()->getParameter('bcc_resque.resque.app_include'); + if (false !== getenv('APP_INCLUDE')) { + $env['APP_INCLUDE'] = getenv('APP_INCLUDE'); + } $env['COUNT'] = $input->getOption('count'); $env['INTERVAL'] = $input->getOption('interval'); $env['QUEUE'] = $input->getArgument('queues'); diff --git a/DependencyInjection/BCCResqueExtension.php b/DependencyInjection/BCCResqueExtension.php index 83cd12c..6cafb50 100644 --- a/DependencyInjection/BCCResqueExtension.php +++ b/DependencyInjection/BCCResqueExtension.php @@ -26,6 +26,7 @@ public function load(array $configs, ContainerBuilder $container) $loader->load('services.xml'); $container->setParameter('bcc_resque.resque.vendor_dir', $config['vendor_dir']); + $container->setParameter('bcc_resque.resque.app_include', $config['app_include']); $container->setParameter('bcc_resque.resque.class', $config['class']); $container->setParameter('bcc_resque.resque.redis.host', $config['redis']['host']); $container->setParameter('bcc_resque.resque.redis.port', $config['redis']['port']); diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 43bf74a..0ae512b 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -28,6 +28,11 @@ public function getConfigTreeBuilder() ->cannotBeEmpty() ->info('Set the vendor dir') ->end() + ->scalarNode('app_include') + ->defaultValue('%kernel.root_dir%/bootstrap.php.cache') + ->cannotBeEmpty() + ->info('Set the APP_INCLUDE for php-resque') + ->end() ->scalarNode('prefix') ->defaultNull() ->end() From 2e5e03c7718eca5bf0dfccd2a3c675365a3ac3d1 Mon Sep 17 00:00:00 2001 From: Michal Kierat Date: Mon, 18 May 2015 13:33:58 +0100 Subject: [PATCH 2/2] Updated the readme --- README.markdown | 1 + 1 file changed, 1 insertion(+) diff --git a/README.markdown b/README.markdown index be3537b..ab95f42 100644 --- a/README.markdown +++ b/README.markdown @@ -104,6 +104,7 @@ You may want to add some configuration to your `config.yml` bcc_resque: class: BCC\ResqueBundle\Resque # the resque class if different from default vendor_dir: %kernel.root_dir%/../vendor # the vendor dir if different from default + app_include: /pathto/bootstrap.php.cache # app include file if different from default prefix: my-resque-prefix # optional prefix to separate Resque data per site/app redis: host: localhost # the redis host