|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Zemit Framework. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Zemit Team <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE.txt |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Zemit\Bootstrap; |
|
13
|
|
|
|
|
14
|
|
|
use Zemit\Models\Lang; |
|
15
|
|
|
use Zemit\Models\Role; |
|
16
|
|
|
use Zemit\Models\Setting; |
|
17
|
|
|
use Zemit\Models\Site; |
|
18
|
|
|
use Zemit\Models\Template; |
|
19
|
|
|
use Zemit\Mvc\Controller\Behavior; |
|
20
|
|
|
use Phalcon\Config as PhalconConfig; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Zemit Deployment Configuration |
|
24
|
|
|
* |
|
25
|
|
|
* @property PhalconConfig $drop |
|
26
|
|
|
* @property PhalconConfig $truncate |
|
27
|
|
|
* @property PhalconConfig $engine |
|
28
|
|
|
* @property PhalconConfig $insert |
|
29
|
|
|
*/ |
|
30
|
|
|
class Deployment extends \Zemit\Config\Config |
|
31
|
|
|
{ |
|
32
|
|
|
public function __construct(array $data = [], bool $insensitive = true) |
|
33
|
|
|
{ |
|
34
|
|
|
parent::__construct([ |
|
35
|
|
|
/** |
|
36
|
|
|
* Tables to drop |
|
37
|
|
|
*/ |
|
38
|
|
|
'drop' => [], |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Tables to truncate |
|
42
|
|
|
*/ |
|
43
|
|
|
'truncate' => [ |
|
44
|
|
|
'audit', |
|
45
|
|
|
'audit_detail', |
|
46
|
|
|
'category', |
|
47
|
|
|
'channel', |
|
48
|
|
|
'data', |
|
49
|
|
|
'email', |
|
50
|
|
|
'email_file', |
|
51
|
|
|
'field', |
|
52
|
|
|
'file', |
|
53
|
|
|
'file_relation', |
|
54
|
|
|
'flag', |
|
55
|
|
|
'group', |
|
56
|
|
|
'group_role', |
|
57
|
|
|
'group_type', |
|
58
|
|
|
'lang', |
|
59
|
|
|
'log', |
|
60
|
|
|
'menu', |
|
61
|
|
|
'meta', |
|
62
|
|
|
'page', |
|
63
|
|
|
'phalcon_migrations', |
|
64
|
|
|
'post', |
|
65
|
|
|
'post_category', |
|
66
|
|
|
'role', |
|
67
|
|
|
'session', |
|
68
|
|
|
'setting', |
|
69
|
|
|
'site', |
|
70
|
|
|
'site_lang', |
|
71
|
|
|
'template', |
|
72
|
|
|
'translate', |
|
73
|
|
|
'translate_field', |
|
74
|
|
|
'translate_table', |
|
75
|
|
|
'type', |
|
76
|
|
|
'user', |
|
77
|
|
|
'user_group', |
|
78
|
|
|
'user_role', |
|
79
|
|
|
'user_type', |
|
80
|
|
|
'validator', |
|
81
|
|
|
], |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* Table engines |
|
85
|
|
|
*/ |
|
86
|
|
|
'engine' => [ |
|
87
|
|
|
'audit' => 'InnoDB', |
|
88
|
|
|
'audit_detail' => 'InnoDB', |
|
89
|
|
|
'category' => 'InnoDB', |
|
90
|
|
|
'channel' => 'InnoDB', |
|
91
|
|
|
'data' => 'InnoDB', |
|
92
|
|
|
'email' => 'InnoDB', |
|
93
|
|
|
'email_file' => 'InnoDB', |
|
94
|
|
|
'field' => 'InnoDB', |
|
95
|
|
|
'file' => 'InnoDB', |
|
96
|
|
|
'file_relation' => 'InnoDB', |
|
97
|
|
|
'flag' => 'InnoDB', |
|
98
|
|
|
'group' => 'InnoDB', |
|
99
|
|
|
'group_role' => 'InnoDB', |
|
100
|
|
|
'group_type' => 'InnoDB', |
|
101
|
|
|
'lang' => 'InnoDB', |
|
102
|
|
|
'log' => 'InnoDB', |
|
103
|
|
|
'menu' => 'InnoDB', |
|
104
|
|
|
'meta' => 'InnoDB', |
|
105
|
|
|
'page' => 'InnoDB', |
|
106
|
|
|
'phalcon_migrations' => 'InnoDB', |
|
107
|
|
|
'post' => 'InnoDB', |
|
108
|
|
|
'post_category' => 'InnoDB', |
|
109
|
|
|
'role' => 'InnoDB', |
|
110
|
|
|
'session' => 'InnoDB', |
|
111
|
|
|
'setting' => 'InnoDB', |
|
112
|
|
|
'site' => 'InnoDB', |
|
113
|
|
|
'site_lang' => 'InnoDB', |
|
114
|
|
|
'template' => 'InnoDB', |
|
115
|
|
|
'translate' => 'InnoDB', |
|
116
|
|
|
'translate_field' => 'InnoDB', |
|
117
|
|
|
'translate_table' => 'InnoDB', |
|
118
|
|
|
'type' => 'InnoDB', |
|
119
|
|
|
'user' => 'InnoDB', |
|
120
|
|
|
'user_group' => 'InnoDB', |
|
121
|
|
|
'user_role' => 'InnoDB', |
|
122
|
|
|
'user_type' => 'InnoDB', |
|
123
|
|
|
'validator' => 'InnoDB', |
|
124
|
|
|
], |
|
125
|
|
|
|
|
126
|
|
|
/** |
|
127
|
|
|
* Insert records |
|
128
|
|
|
*/ |
|
129
|
|
|
'insert' => [ |
|
130
|
|
|
Role::class => [ |
|
131
|
|
|
['index' => 'dev', 'label' => 'Developer', 'userlist' => [ |
|
132
|
|
|
['username' => 'dev', 'email' => '[email protected]', 'firstName' => 'Developer', 'lastName' => 'Zemit'], |
|
133
|
|
|
]], |
|
134
|
|
|
['index' => 'admin', 'label' => 'Administrator'], |
|
135
|
|
|
['index' => 'user', 'label' => 'User'], |
|
136
|
|
|
['index' => 'guest', 'label' => 'Guest'], |
|
137
|
|
|
['index' => 'everyone', 'label' => 'Everyone'], |
|
138
|
|
|
], |
|
139
|
|
|
// User::class => [ |
|
140
|
|
|
// ['username' => 'dev', 'email' => '[email protected]', 'firstName' => 'Developer', 'lastName' => 'Zemit'], |
|
141
|
|
|
// ], |
|
142
|
|
|
Lang::class => [ |
|
143
|
|
|
['label' => 'Francais', 'code' => 'fr'], |
|
144
|
|
|
['label' => 'English', 'code' => 'en'], |
|
145
|
|
|
['label' => 'Spanish', 'code' => 'sp'], |
|
146
|
|
|
], |
|
147
|
|
|
Site::class => [ |
|
148
|
|
|
['name' => 'Zemit CMS', 'title' => 'Zemit CMS', 'description' => ''], |
|
149
|
|
|
], |
|
150
|
|
|
Template::class => [ |
|
151
|
|
|
], |
|
152
|
|
|
Setting::class => [ |
|
153
|
|
|
], |
|
154
|
|
|
], |
|
155
|
|
|
], $insensitive); |
|
156
|
|
|
|
|
157
|
|
|
if (!empty($data)) { |
|
158
|
|
|
$this->merge(new PhalconConfig($data, $insensitive)); |
|
159
|
|
|
} |
|
160
|
|
|
} |
|
161
|
|
|
} |
|
162
|
|
|
|