mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-09 16:44:26 +02:00
Improve dba::selectFirst calls
- Fix remaining $r[0] references - Rename $r to meaningful names
This commit is contained in:
parent
465e1d6a5c
commit
5fc4927764
29 changed files with 228 additions and 250 deletions
|
@ -109,10 +109,10 @@ class Cache
|
|||
// Frequently clear cache
|
||||
self::clear();
|
||||
|
||||
$r = dba::selectFirst('cache', ['v'], ['k' => $key]);
|
||||
$cache = dba::selectFirst('cache', ['v'], ['k' => $key]);
|
||||
|
||||
if (DBM::is_result($r)) {
|
||||
$cached = $r['v'];
|
||||
if (DBM::is_result($cache)) {
|
||||
$cached = $cache['v'];
|
||||
$value = @unserialize($cached);
|
||||
|
||||
// Only return a value if the serialized value is valid.
|
||||
|
|
|
@ -97,10 +97,10 @@ class Config
|
|||
}
|
||||
}
|
||||
|
||||
$ret = dba::selectFirst('config', ['v'], ['cat' => $family, 'k' => $key]);
|
||||
if (DBM::is_result($ret)) {
|
||||
$config = dba::selectFirst('config', ['v'], ['cat' => $family, 'k' => $key]);
|
||||
if (DBM::is_result($config)) {
|
||||
// manage array value
|
||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $config['v']) ? unserialize($config['v']) : $config['v']);
|
||||
|
||||
// Assign the value from the database to the cache
|
||||
self::$cache[$family][$key] = $val;
|
||||
|
|
|
@ -90,9 +90,9 @@ class PConfig
|
|||
}
|
||||
}
|
||||
|
||||
$ret = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $family, 'k' => $key]);
|
||||
if (DBM::is_result($ret)) {
|
||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $ret['v']) ? unserialize($ret['v']) : $ret['v']);
|
||||
$pconfig = dba::selectFirst('pconfig', ['v'], ['uid' => $uid, 'cat' => $family, 'k' => $key]);
|
||||
if (DBM::is_result($pconfig)) {
|
||||
$val = (preg_match("|^a:[0-9]+:{.*}$|s", $pconfig['v']) ? unserialize($pconfig['v']) : $pconfig['v']);
|
||||
$a->config[$uid][$family][$key] = $val;
|
||||
self::$in_db[$uid][$family][$key] = true;
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ class Worker
|
|||
private static function highestPriority()
|
||||
{
|
||||
$condition = array("`executed` <= ? AND NOT `done`", NULL_DATE);
|
||||
$s = dba::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
||||
if (DBM::is_result($s)) {
|
||||
return $s["priority"];
|
||||
$workerqueue = dba::selectFirst('workerqueue', ['priority'], $condition, ['order' => ['priority']]);
|
||||
if (DBM::is_result($workerqueue)) {
|
||||
return $workerqueue["priority"];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue