Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing in APP_INCLUDE to php-resque #127

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Command/StartScheduledWorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
5 changes: 4 additions & 1 deletion Command/StartWorkerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/BCCResqueExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
5 changes: 5 additions & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down