mirror of
https://github.com/friendica/friendica
synced 2025-04-25 09:10:11 +00:00
Modifed "update" and "insert" function / many changed queries
This commit is contained in:
parent
a5e7f7bf70
commit
fce72cbbc8
11 changed files with 66 additions and 123 deletions
|
@ -164,19 +164,11 @@ class Config {
|
|||
$dbvalue = (is_array($value) ? serialize($value) : $dbvalue);
|
||||
|
||||
if (is_null($stored) || !self::$in_db[$family][$key]) {
|
||||
$ret = q("INSERT INTO `config` (`cat`, `k`, `v`) VALUES ('%s', '%s', '%s') ON DUPLICATE KEY UPDATE `v` = '%s'",
|
||||
dbesc($family),
|
||||
dbesc($key),
|
||||
dbesc($dbvalue),
|
||||
dbesc($dbvalue)
|
||||
);
|
||||
dba::insert('config', array('cat' => $family, 'k' => $key, 'v' => $dbvalue), true);
|
||||
} else {
|
||||
$ret = q("UPDATE `config` SET `v` = '%s' WHERE `cat` = '%s' AND `k` = '%s'",
|
||||
dbesc($dbvalue),
|
||||
dbesc($family),
|
||||
dbesc($key)
|
||||
);
|
||||
dba::update('config', array('v' => $dbvalue), array('cat' => $family, 'k' => $key), true);
|
||||
}
|
||||
|
||||
if ($ret) {
|
||||
self::$in_db[$family][$key] = true;
|
||||
return $value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue