Merge remote-tracking branch 'origin/QA_4_6' into QA_4_6

This commit is contained in:
Weblate 2016-12-13 11:24:18 +01:00
commit a1fa82f39b

View File

@ -2964,6 +2964,20 @@ class Util
self::cacheUnset('is_grantuser');
}
/**
* Calculates session cache key
*
* @return string
*/
public static function cacheKey()
{
if (isset($GLOBALS['cfg']['Server']['user'])) {
return 'server_' . $GLOBALS['server'] . '_' . $GLOBALS['cfg']['Server']['user'];
} else {
return 'server_' . $GLOBALS['server'];
}
}
/**
* Verifies if something is cached in the session
*
@ -2973,7 +2987,7 @@ class Util
*/
public static function cacheExists($var)
{
return isset($_SESSION['cache']['server_' . $GLOBALS['server'] . '_' . $GLOBALS['cfg']['Server']['user']][$var]);
return isset($_SESSION['cache'][self::cacheKey()][$var]);
}
/**
@ -2987,7 +3001,7 @@ class Util
public static function cacheGet($var, $callback = null)
{
if (self::cacheExists($var)) {
return $_SESSION['cache']['server_' . $GLOBALS['server'] . '_' . $GLOBALS['cfg']['Server']['user']][$var];
return $_SESSION['cache'][self::cacheKey()][$var];
} else {
if ($callback) {
$val = $callback();
@ -3008,7 +3022,7 @@ class Util
*/
public static function cacheSet($var, $val = null)
{
$_SESSION['cache']['server_' . $GLOBALS['server'] . '_' . $GLOBALS['cfg']['Server']['user']][$var] = $val;
$_SESSION['cache'][self::cacheKey()][$var] = $val;
}
/**
@ -3020,7 +3034,7 @@ class Util
*/
public static function cacheUnset($var)
{
unset($_SESSION['cache']['server_' . $GLOBALS['server'] . '_' . $GLOBALS['cfg']['Server']['user']][$var]);
unset($_SESSION['cache'][self::cacheKey()][$var]);
}
/**