Skip to content

Commit

Permalink
CS-5484: Adds configuration option for jobby environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
m038 committed Oct 15, 2014
1 parent 7204b85 commit 7dcd534
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 2 additions & 0 deletions newscoop/application/configs/parameters/parameters.yml
Expand Up @@ -149,3 +149,5 @@ parameters:
search.article:
type: ["news"]
rendition: ''
jobby:
environment: 'prod'
4 changes: 3 additions & 1 deletion newscoop/application/configs/parameters/parameters_cli.yml
Expand Up @@ -4,4 +4,6 @@ parameters:
acl:
cache: "Doctrine\Common\Cache\ArrayCache"
doctrine:
cache: "array"
cache: "array"
jobby:
environment: 'cli'
Expand Up @@ -13,4 +13,6 @@ parameters:
params:
displayExceptions: "1"
session:
cookie_domain: ""
cookie_domain: ""
jobby:
environment: 'dev'
Expand Up @@ -37,3 +37,5 @@ parameters:
frontController:
params:
displayExceptions: true
jobby:
environment: 'test'
8 changes: 4 additions & 4 deletions newscoop/library/Newscoop/Services/SchedulerService.php
Expand Up @@ -55,10 +55,6 @@ public function registerJob($jobName, array $config)
$cronJob->{$setter}($value);
}

if (array_key_exists('environment', $this->$config) && !empty($this->config['environment'])) {
$cronJob->setEnvironment($this->config['environment']);
}

$cronJob->setName($jobName);
$this->em->persist($cronJob);
$this->em->flush($cronJob);
Expand Down Expand Up @@ -96,6 +92,10 @@ public function removeJob($jobName, array $config)
*/
public function addSchedulerJob($jobName, array $config)
{
if (array_key_exists('environment', $this->config) && !empty($this->config['environment'])) {
$config['environment'] = $this->config['environment'];
}

$this->jobby->add($jobName, $config);
}

Expand Down

0 comments on commit 7dcd534

Please sign in to comment.