Browse Source

Ensure that with multiple entries the newest one will be fetched

pull/2853/head
Michael Vogel 5 years ago
parent
commit
4322b56c0b
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      include/Core/Config.php
  2. +2
    -2
      include/Core/PConfig.php

+ 2
- 2
include/Core/Config.php View 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)
);


+ 2
- 2
include/Core/PConfig.php View 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)


Loading…
Cancel
Save