1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
* |
15
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the MIT license. |
17
|
|
|
*/ |
18
|
|
|
|
19
|
|
|
namespace StrokerCache; |
20
|
|
|
|
21
|
|
|
use StrokerCache\Listener\CacheListener; |
22
|
|
|
use Zend\Console\Adapter\AdapterInterface; |
23
|
|
|
use Zend\EventManager\EventInterface; |
24
|
|
|
use Zend\ModuleManager\Feature; |
25
|
|
|
|
26
|
|
|
class Module implements |
27
|
|
|
Feature\ConfigProviderInterface, |
28
|
|
|
Feature\ConsoleBannerProviderInterface, |
29
|
|
|
Feature\ConsoleUsageProviderInterface, |
30
|
|
|
Feature\AutoloaderProviderInterface, |
31
|
|
|
Feature\BootstrapListenerInterface |
32
|
|
|
{ |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* {@inheritDoc} |
36
|
|
|
*/ |
37
|
|
|
public function getConfig() |
38
|
|
|
{ |
39
|
|
|
return include __DIR__ . '/config/module.config.php'; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* {@inheritDoc} |
44
|
|
|
*/ |
45
|
|
|
public function getAutoloaderConfig() |
46
|
|
|
{ |
47
|
|
|
return array( |
48
|
|
|
'Zend\Loader\StandardAutoloader' => array( |
49
|
|
|
'namespaces' => array( |
50
|
|
|
__NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, |
51
|
|
|
), |
52
|
|
|
), |
53
|
|
|
); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* {@inheritDoc} |
58
|
|
|
*/ |
59
|
|
|
public function onBootstrap(EventInterface $e) |
60
|
|
|
{ |
61
|
|
|
/** @var $application \Zend\Mvc\Application */ |
62
|
|
|
$application = $e->getParam('application'); |
63
|
|
|
$listener = $application->getServiceManager()->get(CacheListener::class); |
64
|
|
|
|
65
|
|
|
$application->getEventManager()->attach($listener); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* {@inheritDoc} |
70
|
|
|
*/ |
71
|
|
|
public function getConsoleBanner(AdapterInterface $console) |
72
|
|
|
{ |
73
|
|
|
return 'StrokerCache ' . Version::VERSION; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* {@inheritDoc} |
78
|
|
|
*/ |
79
|
|
|
public function getConsoleUsage(AdapterInterface $console) |
80
|
|
|
{ |
81
|
|
|
return array( |
82
|
|
|
'Usage:', |
83
|
|
|
'strokercache clear <tags>' => 'Invalidate cache items by tags', |
84
|
|
|
|
85
|
|
|
array('<tags>' => 'List of tags, optionally separated by commas') |
86
|
|
|
); |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
This check looks for function calls that miss required arguments.