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