aboutsummaryrefslogtreecommitdiffstats
path: root/include/config.php
diff options
context:
space:
mode:
authorMichael Vogel <icarus@dabo.de>2012-05-26 15:41:23 +0200
committerMichael Vogel <icarus@dabo.de>2012-05-26 15:41:23 +0200
commit7f19d39b146844fd71d148690d3e550df9d3043b (patch)
treecbf1a8e13276589a4952a766ebd7311121477d28 /include/config.php
parenta5dc41ab131d4235eb947ff00d7af0593bf0e460 (diff)
downloadvolse-hubzilla-7f19d39b146844fd71d148690d3e550df9d3043b.tar.gz
volse-hubzilla-7f19d39b146844fd71d148690d3e550df9d3043b.tar.bz2
volse-hubzilla-7f19d39b146844fd71d148690d3e550df9d3043b.zip
Doing negative caching for config values, special logfile for database optmisations
Diffstat (limited to 'include/config.php')
-rw-r--r--include/config.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/config.php b/include/config.php
index 6edc3f286..df1070c13 100644
--- a/include/config.php
+++ b/include/config.php
@@ -30,6 +30,9 @@ function load_config($family) {
$a->config[$family][$k] = $rr['v'];
}
}
+ } else if ($rr['cat'] != 'config') {
+ // Negative caching
+ $a->config[$family] = "!<unset>!";
}
}}
@@ -47,6 +50,13 @@ function get_config($family, $key, $instore = false) {
global $a;
if(! $instore) {
+ // Looking if the whole family isn't set
+ if(isset($a->config[$family])) {
+ if($a->config[$family] === '!<unset>!') {
+ return false;
+ }
+ }
+
if(isset($a->config[$family][$key])) {
if($a->config[$family][$key] === '!<unset>!') {
return false;
@@ -87,11 +97,11 @@ function set_config($family,$key,$value) {
dbesc($key),
dbesc($dbvalue)
);
- if($ret)
+ if($ret)
return $value;
return $ret;
}
-
+
$ret = q("UPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s' LIMIT 1",
dbesc($dbvalue),
dbesc($family),
@@ -118,6 +128,9 @@ function load_pconfig($uid,$family) {
$k = $rr['k'];
$a->config[$uid][$family][$k] = $rr['v'];
}
+ } else if ($rr['cat'] != 'config') {
+ // Negative caching
+ $a->config[$uid][$family] = "!<unset>!";
}
}}
@@ -129,6 +142,13 @@ function get_pconfig($uid,$family, $key, $instore = false) {
global $a;
if(! $instore) {
+ // Looking if the whole family isn't set
+ if(isset($a->config[$uid][$family])) {
+ if($a->config[$uid][$family] === '!<unset>!') {
+ return false;
+ }
+ }
+
if(isset($a->config[$uid][$family][$key])) {
if($a->config[$uid][$family][$key] === '!<unset>!') {
return false;