]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that with multiple entries the newest one will be fetched
authorMichael Vogel <ike@pirati.ca>
Sun, 9 Oct 2016 07:18:52 +0000 (07:18 +0000)
committerMichael Vogel <ike@pirati.ca>
Sun, 9 Oct 2016 07:18:52 +0000 (07:18 +0000)
include/Core/Config.php
include/Core/PConfig.php

index e5515efafc43b75ff600069c1360c57d0af17531..a93f188148e9c76740edd8205a8823fa895766eb 100644 (file)
@@ -32,7 +32,7 @@ class Config {
        public static function load($family) {
                global $a;
 
-               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s'", dbesc($family));
+               $r = q("SELECT `v`, `k` FROM `config` WHERE `cat` = '%s' ORDER BY `cat`, `k`, `id`", dbesc($family));
                if(count($r)) {
                        foreach($r as $rr) {
                                $k = $rr['k'];
@@ -90,7 +90,7 @@ class Config {
                        }
                }
 
-               $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' ORDER BY `id` DESC LIMIT 1",
                        dbesc($family),
                        dbesc($key)
                );
index 082f1c05c2f85d3097f2daf9655987611631d476..de8994d1decf2219aa378602b25247fd724eaf51 100644 (file)
@@ -29,7 +29,7 @@ class PConfig {
         */
        public static function load($uid,$family) {
                global $a;
-               $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d",
+               $r = q("SELECT `v`,`k` FROM `pconfig` WHERE `cat` = '%s' AND `uid` = %d ORDER BY `cat`, `k`, `id`",
                        dbesc($family),
                        intval($uid)
                );
@@ -83,7 +83,7 @@ class PConfig {
                        }
                }
 
-               $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' LIMIT 1",
+               $ret = q("SELECT `v` FROM `pconfig` WHERE `uid` = %d AND `cat` = '%s' AND `k` = '%s' ORDER BY `id` DESC LIMIT 1",
                        intval($uid),
                        dbesc($family),
                        dbesc($key)