mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-09 16:44:26 +02:00
fixing preload adapter
This commit is contained in:
parent
1dee89f215
commit
13807129aa
4 changed files with 18 additions and 23 deletions
|
@ -49,7 +49,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
|
||||
$pconfigs = DBA::select('pconfig', ['cat', 'v', 'k'], ['uid' => $uid]);
|
||||
while ($pconfig = DBA::fetch($pconfigs)) {
|
||||
$value = $pconfig['v'];
|
||||
$value = $this->toConfigValue($pconfig['v']);
|
||||
if (isset($value)) {
|
||||
$return[$pconfig['cat']][$pconfig['k']] = $value;
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
|
||||
$config = DBA::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $cat, 'k' => $key]);
|
||||
if (DBA::isResult($config)) {
|
||||
// manage array value
|
||||
$value = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
||||
$value = $this->toConfigValue($config['v']);
|
||||
|
||||
if (isset($value)) {
|
||||
return $value;
|
||||
|
@ -102,13 +101,13 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
// So we have to do the conversion here so that the compare below works.
|
||||
// The exception are array values.
|
||||
$compare_value = !is_array($value) ? (string)$value : $value;
|
||||
$stored_value = $this->get($uid, $cat, $key);
|
||||
|
||||
if ($this->get($uid, $cat, $key) === $compare_value) {
|
||||
if (isset($stored_value) && $stored_value === $compare_value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// manage array value
|
||||
$dbvalue = is_array($value) ? serialize($value) : $value;
|
||||
$dbvalue = $this->toDbValue($value);
|
||||
|
||||
return DBA::update('pconfig', ['v' => $dbvalue], ['uid' => $uid, 'cat' => $cat, 'k' => $key], true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue