* added msg-level INFO
  * changed some WARN-level messages to INFO
Util
  * added function to handle directories aowow wants to write to / read from
SiteConfig
  * group options to be less cluttered
  * allow empty strings (numerical values must still at least be 0)
  * renamed account related config values to be make more sense
  * make cache path configurable
  * make session save path configurable - use this to avoid the garbage collect cron job on Debian or Ubuntu, that cleans sessions and only depends on your php.ini (NOTE: putting this inside a web-enabled directory is a risk!)
This commit is contained in:
Sarjuuk
2015-07-08 23:19:23 +02:00
parent 4a47900860
commit 0cb5d6b896
18 changed files with 179 additions and 130 deletions

View File

@@ -68,12 +68,15 @@ if (!empty($AoWoWconf['characters']))
$sets = DB::isConnectable(DB_AOWOW) ? DB::Aowow()->select('SELECT `key` AS ARRAY_KEY, `value`, `flags` FROM ?_config') : [];
foreach ($sets as $k => $v)
{
// this should not have been possible
if (!strlen($v['value']))
continue;
$php = $v['flags'] & CON_FLAG_PHP;
// this should not have been possible
if (!strlen($v['value']) && !($v['flags'] & CON_FLAG_TYPE_STRING) && !$php)
{
Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: Aowow config value CFG_'.strtoupper($k).' is empty - config will not be used!');
continue;
}
if ($v['flags'] & CON_FLAG_TYPE_INT)
$val = intVal($v['value']);
else if ($v['flags'] & CON_FLAG_TYPE_FLOAT)
@@ -82,9 +85,14 @@ foreach ($sets as $k => $v)
$val = (bool)$v['value'];
else if ($v['flags'] & CON_FLAG_TYPE_STRING)
$val = preg_replace('/[^\p{L}0-9~\s_\-\'\/\.:,]/ui', '', $v['value']);
else
else if ($php)
{
Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: '.($php ? 'PHP' : 'Aowow').' config value '.($php ? strtolower($k) : 'CFG_'.strtoupper($k)).' has no type set. Value forced to 0!');
Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: PHP config value '.strtolower($k).' has no type set - config will not be used!');
continue;
}
else // if (!$php)
{
Util::addNote(U_GROUP_ADMIN | U_GROUP_DEV, 'Kernel: Aowow config value CFG_'.strtoupper($k).' has no type set - value forced to 0!');
$val = 0;
}
@@ -149,6 +157,9 @@ if (!CLI)
die('error: SITE_HOST or STATIC_HOST not configured');
// Setup Session
if (CFG_SESSION_CACHE_DIR && Util::checkOrCreateDirectory(CFG_SESSION_CACHE_DIR))
session_save_path(CFG_SESSION_CACHE_DIR);
session_set_cookie_params(15 * YEAR, '/', '', $secure, true);
session_cache_limiter('private');
session_start();