config && pconfig: return NULL if config is unset
This commit is contained in:
parent
7e8ea1cb87
commit
023c43fa4a
|
@ -64,10 +64,11 @@ class Config {
|
||||||
* The category of the configuration value
|
* The category of the configuration value
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* The configuration key to query
|
* The configuration key to query
|
||||||
* @param boolean $instore Determines if the key already exists in the DB
|
* @param boolean $refresh
|
||||||
* @return mixed Stored value or false if it does not exist
|
* If true the config is loaded from the db and not from the cache
|
||||||
|
* @return mixed Stored value or null if it does not exist
|
||||||
*/
|
*/
|
||||||
public static function get($family, $key, $instore = false) {
|
public static function get($family, $key, $refresh = false) {
|
||||||
|
|
||||||
global $a;
|
global $a;
|
||||||
|
|
||||||
|
@ -75,13 +76,13 @@ class Config {
|
||||||
// Looking if the whole family isn't set
|
// Looking if the whole family isn't set
|
||||||
if(isset($a->config[$family])) {
|
if(isset($a->config[$family])) {
|
||||||
if($a->config[$family] === '!<unset>!') {
|
if($a->config[$family] === '!<unset>!') {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($a->config[$family][$key])) {
|
if(isset($a->config[$family][$key])) {
|
||||||
if($a->config[$family][$key] === '!<unset>!') {
|
if($a->config[$family][$key] === '!<unset>!') {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
return $a->config[$family][$key];
|
return $a->config[$family][$key];
|
||||||
}
|
}
|
||||||
|
@ -136,7 +137,7 @@ class Config {
|
||||||
elseif (function_exists("xcache_set"))
|
elseif (function_exists("xcache_set"))
|
||||||
xcache_set($family."|".$key, '!<unset>!', 600);*/
|
xcache_set($family."|".$key, '!<unset>!', 600);*/
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -57,11 +57,11 @@ class PConfig {
|
||||||
* The category of the configuration value
|
* The category of the configuration value
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* The configuration key to query
|
* The configuration key to query
|
||||||
* @param boolean $instore
|
* @param boolean $refresh
|
||||||
* Determines if the key already exists in the DB
|
* If true the config is loaded from the db and not from the cache
|
||||||
* @return mixed Stored value or false if it does not exist
|
* @return mixed Stored value or null if it does not exist
|
||||||
*/
|
*/
|
||||||
public static function get($uid,$family, $key, $instore = false) {
|
public static function get($uid, $family, $key, $refresh = false) {
|
||||||
|
|
||||||
global $a;
|
global $a;
|
||||||
|
|
||||||
|
@ -69,13 +69,13 @@ class PConfig {
|
||||||
// Looking if the whole family isn't set
|
// Looking if the whole family isn't set
|
||||||
if(isset($a->config[$uid][$family])) {
|
if(isset($a->config[$uid][$family])) {
|
||||||
if($a->config[$uid][$family] === '!<unset>!') {
|
if($a->config[$uid][$family] === '!<unset>!') {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($a->config[$uid][$family][$key])) {
|
if(isset($a->config[$uid][$family][$key])) {
|
||||||
if($a->config[$uid][$family][$key] === '!<unset>!') {
|
if($a->config[$uid][$family][$key] === '!<unset>!') {
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
return $a->config[$uid][$family][$key];
|
return $a->config[$uid][$family][$key];
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ class PConfig {
|
||||||
elseif (function_exists("xcache_set"))
|
elseif (function_exists("xcache_set"))
|
||||||
xcache_set($uid."|".$family."|".$key, '!<unset>!', 600);*/
|
xcache_set($uid."|".$family."|".$key, '!<unset>!', 600);*/
|
||||||
}
|
}
|
||||||
return false;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,11 +39,16 @@ function load_config($family) {
|
||||||
* The category of the configuration value
|
* The category of the configuration value
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* The configuration key to query
|
* The configuration key to query
|
||||||
* @param boolean $instore Determines if the key already exists in the DB
|
* @param boolean $refresh
|
||||||
|
* If true the config is loaded from the db and not from the cache
|
||||||
* @return mixed Stored value or false if it does not exist
|
* @return mixed Stored value or false if it does not exist
|
||||||
*/
|
*/
|
||||||
function get_config($family, $key, $instore = false) {
|
function get_config($family, $key, $refresh = false) {
|
||||||
return Config::get($family, $key, $instore);
|
$v = Config::get($family, $key, $refresh);
|
||||||
|
if(is_null($v))
|
||||||
|
$v = false;
|
||||||
|
|
||||||
|
return $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -105,12 +110,16 @@ function load_pconfig($uid,$family) {
|
||||||
* The category of the configuration value
|
* The category of the configuration value
|
||||||
* @param string $key
|
* @param string $key
|
||||||
* The configuration key to query
|
* The configuration key to query
|
||||||
* @param boolean $instore
|
* @param boolean $refresh
|
||||||
* Determines if the key already exists in the DB
|
* If true the config is loaded from the db and not from the cache
|
||||||
* @return mixed Stored value or false if it does not exist
|
* @return mixed Stored value or false if it does not exist
|
||||||
*/
|
*/
|
||||||
function get_pconfig($uid,$family, $key, $instore = false) {
|
function get_pconfig($uid, $family, $key, $refresh = false) {
|
||||||
return PConfig::get($uid, $family, $key, $instore);
|
$v = PConfig::get($uid, $family, $key, $refresh);
|
||||||
|
if(is_null($v))
|
||||||
|
$v = false;
|
||||||
|
|
||||||
|
return $v;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user