mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 08:34:11 +03:00
Prevent system from using uninitialized values when configuration doesn't exists
This commit is contained in:
parent
d512573af8
commit
c70bdfcd90
@ -52,6 +52,21 @@ function load_system_configs()
|
||||
if (empty($configs['cache'])) {
|
||||
$configs['cache'] = array();
|
||||
}
|
||||
|
||||
// Database section should exists too. Also it should have an appropriate structure.
|
||||
if (empty($configs['database'])) {
|
||||
$configs['database'] = array();
|
||||
}
|
||||
foreach (array('host', 'port', 'db', 'login', 'pass', 'tables_prefix', 'use_persistent_connection') as $key) {
|
||||
if (!array_key_exists($key, $configs['database'])) {
|
||||
$configs['database'][$key] = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Mailbox value should exists.
|
||||
if (!array_key_exists('mailbox', $configs)) {
|
||||
$configs['mailbox'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
return $configs;
|
||||
|
Loading…
Reference in New Issue
Block a user