|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Spiral; |
|
4
|
|
|
|
|
5
|
|
|
use Spiral\Core\DirectoriesInterface; |
|
6
|
|
|
use Spiral\Modules\ModuleInterface; |
|
7
|
|
|
use Spiral\Modules\PublisherInterface; |
|
8
|
|
|
use Spiral\Modules\RegistratorInterface; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Spiral Framework. |
|
12
|
|
|
* |
|
13
|
|
|
* @license MIT |
|
14
|
|
|
* @author Valentin V (vvval) |
|
15
|
|
|
*/ |
|
16
|
|
|
class SnapshotterModule implements ModuleInterface |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* @param RegistratorInterface $registrator |
|
20
|
|
|
*/ |
|
21
|
|
|
public function register(RegistratorInterface $registrator) |
|
22
|
|
|
{ |
|
23
|
|
|
//Register tokenizer directory |
|
24
|
|
|
$registrator->configure('tokenizer', 'directories', 'spiral/snapshotter', [ |
|
25
|
|
|
"directory('libraries') . 'spiral/snapshotter/source/Snapshotter/',", |
|
26
|
|
|
]); |
|
27
|
|
|
|
|
28
|
|
|
//Register view namespace |
|
29
|
|
|
$registrator->configure('views', 'namespaces', 'spiral/snapshotter', [ |
|
30
|
|
|
"'snapshotter' => [", |
|
31
|
|
|
" directory('libraries') . 'spiral/snapshotter/source/views/',", |
|
32
|
|
|
" /*{{namespaces.snapshotter}}*/", |
|
33
|
|
|
"]," |
|
34
|
|
|
]); |
|
35
|
|
|
|
|
36
|
|
|
//Register database settings |
|
37
|
|
|
$registrator->configure('databases', 'aliases', 'spiral/snapshotter', [ |
|
38
|
|
|
"'snapshots' => 'default'," |
|
39
|
|
|
]); |
|
40
|
|
|
|
|
41
|
|
|
//Register controller in navigation config |
|
42
|
|
|
$registrator->configure('modules/vault', 'controllers', 'spiral/snapshotter', [ |
|
43
|
|
|
"'snapshots' => \\Spiral\\Snapshotter\\AbstractController::class,", |
|
44
|
|
|
]); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param PublisherInterface $publisher |
|
49
|
|
|
* @param DirectoriesInterface $directories |
|
50
|
|
|
*/ |
|
51
|
|
|
public function publish(PublisherInterface $publisher, DirectoriesInterface $directories) |
|
52
|
|
|
{ |
|
53
|
|
|
} |
|
54
|
|
|
} |