1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* YAWIK |
4
|
|
|
* Auth Module Bootstrap |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
7
|
|
|
* @license MIT |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Jobs; |
11
|
|
|
|
12
|
|
|
use Zend\Mvc\MvcEvent; |
13
|
|
|
use Zend\Console\Adapter\AdapterInterface as Console; |
14
|
|
|
use Zend\ModuleManager\Feature\ConsoleUsageProviderInterface; |
15
|
|
|
use Core\ModuleManager\ModuleConfigLoader; |
16
|
|
|
use Yawik\Composer\RequireDirectoryPermissionInterface; |
17
|
|
|
use Core\Options\ModuleOptions as CoreOptions; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Bootstrap class of the Core module |
21
|
|
|
*/ |
22
|
|
|
class Module implements ConsoleUsageProviderInterface, RequireDirectoryPermissionInterface |
23
|
|
|
{ |
24
|
|
|
|
25
|
|
|
public function getRequiredDirectoryLists(CoreOptions $options) |
26
|
|
|
{ |
27
|
|
|
return [ |
28
|
|
|
$options->getPublicDir().'/static/Jobs', |
29
|
|
|
$options->getPublicDir().'/static/Jobs/logos', |
30
|
|
|
]; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
public function getConsoleUsage(Console $console) |
34
|
|
|
{ |
35
|
|
|
return [ |
36
|
|
|
'Expire jobs', |
37
|
|
|
'jobs expire [--days] [--limit] [--info]' => 'Expire jobs', |
38
|
|
|
['--days=INT', 'expire jobs after <days> days. Default 30'], |
39
|
|
|
['--limit=INT[,<offset>]', 'Limit jobs to expire per run starting from <offset>. Default 10. 0 means no limit'], |
40
|
|
|
['--info', 'Does not manipulate the database, but prints a list of all matched jobs.'] |
41
|
|
|
]; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Loads module specific configuration. |
46
|
|
|
* |
47
|
|
|
* @return array |
48
|
|
|
*/ |
49
|
5 |
|
public function getConfig() |
50
|
|
|
{ |
51
|
5 |
|
return ModuleConfigLoader::load(__DIR__ . '/../config'); |
52
|
|
|
} |
53
|
|
|
|
54
|
4 |
|
public function onBootstrap(MvcEvent $e) |
55
|
|
|
{ |
56
|
4 |
|
$eventManager = $e->getApplication()->getEventManager(); |
57
|
4 |
|
$services = $e->getApplication()->getServiceManager(); |
58
|
4 |
|
$sharedManager = $eventManager->getSharedManager(); |
59
|
|
|
|
60
|
4 |
|
$defaultlistener = $services->get('Jobs/Listener/Publisher'); |
61
|
4 |
|
$defaultlistener->attachShared($sharedManager); |
62
|
4 |
|
} |
63
|
|
|
} |
64
|
|
|
|