-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.php
79 lines (56 loc) · 1.51 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
namespace atuin\installation;
use atuin\installation\libraries\InstallationManager;
use Yii;
/**
* Class Module
*
* Module that will handle the basic installation of the Atuin system.
*
* @package atuin\installation
*/
class Module extends \atuin\skeleton\Module
{
protected static $_id = 'installation';
protected static $_version = '0.0.1';
public $is_core_module = 1;
private $_subDirectories = [
'routes' => 'routes',
'config' => 'config'
];
private $_installationDirectory;
/**
* @inheritdoc
*/
public function init()
{
parent::init();
$this->_installationDirectory = dirname(Yii::$app->getVendorPath()) . '/atuin';
}
public function checkInstallation()
{
return InstallationManager::checkInstallation();
}
public function getInstallationDirectory($subdirectory = NULL)
{
$subdirectoryUrl = '';
if (!is_null($subdirectory))
{
$subdirectoryUrl = $this->_subDirectories[$subdirectory] . '/';
}
return $this->_installationDirectory . '/' . $subdirectoryUrl;
}
public function getSubdirectories($subdirectory = NULL)
{
if (is_null($subdirectory))
{
return $this->_subDirectories;
}
return $this->_subDirectories[$subdirectory];
}
public function launchInstallation()
{
$installationManager = new InstallationManager();
return $installationManager->execute();
}
}