* immediately reload config.lua when there's change in config.server_path detected

This commit is contained in:
slawkens1 2018-01-06 03:07:17 +01:00
parent 9c281511fa
commit 31537687c1

View File

@ -8,6 +8,7 @@
* @link http://my-aac.org
*/
defined('MYAAC') or die('Direct access not allowed!');
// load configuration
require_once(BASE . 'config.php');
if(file_exists(BASE . 'config.local.php')) // user customizations
@ -87,21 +88,26 @@ if(isset($_REQUEST))
}
// load otserv config file
$tmp = '';
if($cache->enabled() && $cache->fetch('config_lua', $tmp)) {
$config_lua_reload = true;
if($cache->enabled()) {
$tmp = null;
if($cache->fetch('server_path', $tmp) && $tmp == $config['server_path']) {
$tmp = null;
if($cache->fetch('config_lua', $tmp) && $tmp) {
$config['lua'] = unserialize($tmp);
/*if(isset($config['lua']['myaac'][0])) {
foreach($config['lua']['myaac'] as $key => $value)
$config[$key] = $value;
}*/
$config_lua_reload = false;
}
}
}
else
{
if($config_lua_reload) {
$config['lua'] = load_config_lua($config['server_path'] . 'config.lua');
// cache config
if($cache->enabled())
if($cache->enabled()) {
$cache->set('config_lua', serialize($config['lua']), 120);
$cache->set('server_path', $config['server_path']);
}
}
unset($tmp);