[WIP] Loading of config .toml's

Deprecate load_config_lua, use MyAAC\Server\Lua\Loader::load instead
This commit is contained in:
slawkens
2026-04-19 16:05:22 +02:00
parent 6e603ad558
commit 1eba4cc509
17 changed files with 268 additions and 123 deletions

View File

@@ -14,6 +14,7 @@ use MyAAC\CsrfToken;
use MyAAC\Hooks;
use MyAAC\Plugins;
use MyAAC\Models\Town;
use MyAAC\Server\Config;
use MyAAC\Server\Vocations;
use MyAAC\Settings;
@@ -90,28 +91,20 @@ foreach($_REQUEST as $var => $value) {
}
// load otserv config file
$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);
$config_lua_reload = false;
}
if(!$cache->fetch('server_path', $tmp) || $tmp != config('server_path')) {
$cache->delete('config_server');
}
}
if($config_lua_reload) {
$config['lua'] = load_config_lua($config['server_path'] . 'config.lua');
if (empty($config['server'])) {
$config['server'] = $config['lua'] = Config::get();
// cache config
if($cache->enabled()) {
$cache->set('config_lua', serialize($config['lua']), 2 * 60);
$cache->set('server_path', $config['server_path'], 10 * 60);
$cache->set('server_path', config('server_path'), 10 * 60);
}
}
unset($tmp);
if(isset($config['lua']['servername']))
$config['lua']['serverName'] = $config['lua']['servername'];