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() 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