1 | <?php |
||
22 | class Config { |
||
23 | use |
||
24 | CRUD, |
||
25 | Singleton; |
||
26 | const INIT_STATE_METHOD = 'init'; |
||
27 | const SYSTEM_MODULE = 'System'; |
||
28 | const SYSTEM_THEME = 'CleverStyle'; |
||
29 | /** |
||
30 | * @var Cache\Prefix |
||
31 | */ |
||
32 | protected $cache; |
||
33 | /** |
||
34 | * Most of general configuration properties |
||
35 | * |
||
36 | * @var array |
||
37 | */ |
||
38 | public $core = []; |
||
39 | /** |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $core_internal = []; |
||
43 | /** |
||
44 | * Configuration of databases, except the main database, parameters of which are stored in configuration file |
||
45 | * |
||
46 | * @var mixed[] |
||
47 | */ |
||
48 | public $db = []; |
||
49 | /** |
||
50 | * Configuration of storages, except the main storage, parameters of which are stored in configuration file |
||
51 | * |
||
52 | * @var mixed[] |
||
53 | */ |
||
54 | public $storage = []; |
||
55 | /** |
||
56 | * Internal structure of components parameters |
||
57 | * |
||
58 | * @var array[] |
||
59 | */ |
||
60 | public $components = []; |
||
61 | /** |
||
62 | * Array of all domains, which allowed to access the site |
||
63 | * |
||
64 | * Contains keys: |
||
65 | * * count - Total count |
||
66 | * * http - Insecure (http) domains |
||
67 | * * https - Secure (https) domains |
||
68 | * |
||
69 | * @var array |
||
70 | */ |
||
71 | public $mirrors; |
||
72 | protected $data_model = [ |
||
73 | 'domain' => 'text', |
||
74 | 'core' => 'json', |
||
75 | 'db' => 'json', |
||
76 | 'storage' => 'json', |
||
77 | 'components' => 'json' |
||
78 | ]; |
||
79 | protected $table = '[prefix]config'; |
||
80 | 4 | protected function cdb () { |
|
91 | /** |
||
92 | * Loading of configuration, initialization of $Config, $Cache, $L and Page objects, Routing processing |
||
93 | * |
||
94 | * @throws ExitException |
||
95 | */ |
||
96 | 54 | protected function construct () { |
|
109 | /** |
||
110 | * Is used to fill `$this->mirrors` using current configuration |
||
111 | */ |
||
112 | 54 | protected function fill_mirrors () { |
|
125 | /** |
||
126 | * Reloading of settings cache |
||
127 | * |
||
128 | * @throws ExitException |
||
129 | */ |
||
130 | 54 | protected function load_configuration () { |
|
169 | /** |
||
170 | * Applying settings without saving changes into db |
||
171 | * |
||
172 | * @return bool |
||
173 | * |
||
174 | * @throws ExitException |
||
175 | */ |
||
176 | 2 | public function apply () { |
|
193 | /** |
||
194 | * Applying settings without saving changes into db |
||
195 | * |
||
196 | * @param bool $cache_not_saved_mark |
||
197 | * |
||
198 | * @return bool |
||
199 | * |
||
200 | * @throws ExitException |
||
201 | */ |
||
202 | 2 | protected function apply_internal ($cache_not_saved_mark = true) { |
|
233 | /** |
||
234 | * Saving settings |
||
235 | * |
||
236 | * @return bool |
||
237 | * |
||
238 | * @throws ExitException |
||
239 | */ |
||
240 | 2 | public function save () { |
|
251 | /** |
||
252 | * Whether configuration was applied (not saved) and can be canceled |
||
253 | * |
||
254 | * @return bool |
||
255 | */ |
||
256 | public function cancel_available () { |
||
259 | /** |
||
260 | * Canceling of applied settings |
||
261 | * |
||
262 | * @throws ExitException |
||
263 | */ |
||
264 | 2 | public function cancel () { |
|
268 | /** |
||
269 | * Get base url of current mirror including language suffix |
||
270 | * |
||
271 | * @return string |
||
272 | */ |
||
273 | 8 | public function base_url () { |
|
284 | /** |
||
285 | * Get base url of main domain |
||
286 | * |
||
287 | * @return string |
||
288 | */ |
||
289 | 14 | public function core_url () { |
|
293 | /** |
||
294 | * Get object for getting db and storage configuration of module |
||
295 | * |
||
296 | * @param string $module_name |
||
297 | * |
||
298 | * @return Config\Module_Properties |
||
299 | */ |
||
300 | 54 | public function module ($module_name) { |
|
307 | } |
||
308 |