]> git.mxchange.org Git - friendica.git/commitdiff
Merge branch 'master' of github.com:annando/friendica
authorMichael Vogel <icarus@dabo.de>
Sat, 26 May 2012 13:42:23 +0000 (15:42 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 26 May 2012 13:42:23 +0000 (15:42 +0200)
include/config.php
include/dba.php

index 6edc3f286c66750d6fce1fdba98a51fb9e517385..df1070c13c6b61ab5c476e5874c619a229a85f7c 100644 (file)
@@ -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;
index 7ecce7270446308126303afd6949362d913973ce..20c08c2dd0d2e0d39bbc49628f4dc7182214bdff 100644 (file)
@@ -77,14 +77,16 @@ class dba {
 
                $this->error = '';
 
-               //@file_put_contents("/tmp/friendica-db.log", datetime_convert().':'.session_id(). ' Start '.$sql."\n", FILE_APPEND);
+               if (get_config("system", "db_log") != "")
+                       @file_put_contents(get_config("system", "db_log"), datetime_convert().':'.session_id(). ' Start '.$sql."\n", FILE_APPEND);
 
                if($this->mysqli)
                        $result = @$this->db->query($sql);
                else
                        $result = @mysql_query($sql,$this->db);
 
-               //@file_put_contents("/tmp/friendica-db.log", datetime_convert().':'.session_id(). ' Stop '."\n", FILE_APPEND);
+               if (get_config("system", "db_log") != "")
+                       @file_put_contents(get_config("system", "db_log"), datetime_convert().':'.session_id(). ' Stop '."\n", FILE_APPEND);
 
                if($this->mysqli) {
                        if($this->db->errno)