cached config glitch

pull/1/head
Mike Macgirvin 2010-08-19 07:15:41 -07:00
parent b16be9e76a
commit adad23a0ea
1 changed files with 7 additions and 6 deletions

View File

@ -579,11 +579,12 @@ function load_config($family) {
if(! function_exists('get_config')) { if(! function_exists('get_config')) {
function get_config($family,$key) { function get_config($family, $key, $instore = false) {
global $a; global $a;
if(! $instore) {
if(isset($a->config[$family][$key])) if(isset($a->config[$family][$key]))
return $a->config[$family][$key]; return $a->config[$family][$key];
}
$ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", $ret = q("SELECT `v` FROM `config` WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
dbesc($family), dbesc($family),
dbesc($key) dbesc($key)
@ -601,7 +602,7 @@ function set_config($family,$key,$value) {
global $a; global $a;
$a->config[$family][$key] = $value; $a->config[$family][$key] = $value;
if(get_config($family,$key) === false) { if(get_config($family,$key,true) === false) {
$ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ", $ret = q("INSERT INTO `config` ( `cat`, `k`, `v` ) VALUES ( '%s', '%s', '%s' ) ",
dbesc($family), dbesc($family),
dbesc($key), dbesc($key),
@ -611,7 +612,7 @@ function set_config($family,$key,$value) {
return $value; return $value;
return $ret; return $ret;
} }
$ret = q("SUPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1", $ret = q("UPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
dbesc($value), dbesc($value),
dbesc($family), dbesc($family),
dbesc($key) dbesc($key)