mirror of
https://github.com/friendica/friendica
synced 2024-11-10 03:02:54 +00:00
set config_loaded with uid
This commit is contained in:
parent
f825fa1d1c
commit
1194e9b41e
1 changed files with 13 additions and 8 deletions
|
@ -13,7 +13,10 @@ use Friendica\Database\DBA;
|
|||
*/
|
||||
class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdapter
|
||||
{
|
||||
private $config_loaded = false;
|
||||
/**
|
||||
* @var array true if config for user is loaded
|
||||
*/
|
||||
private $config_loaded;
|
||||
|
||||
/**
|
||||
* @param int $uid The UID of the current user
|
||||
|
@ -25,6 +28,8 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
if (isset($uid)) {
|
||||
$this->load($uid, 'config');
|
||||
}
|
||||
|
||||
$this->config_loaded = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,11 +39,11 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
{
|
||||
$return = [];
|
||||
|
||||
if ($this->config_loaded) {
|
||||
if (empty($uid)) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
if (empty($uid)) {
|
||||
if ($this->isLoaded($uid, $cat, null)) {
|
||||
return $return;
|
||||
}
|
||||
|
||||
|
@ -53,7 +58,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
}
|
||||
DBA::close($pconfigs);
|
||||
|
||||
$this->config_loaded = true;
|
||||
$this->config_loaded[$uid] = true;
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -67,7 +72,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
return '!<unset>!';
|
||||
}
|
||||
|
||||
if (!$this->config_loaded) {
|
||||
if (!$this->isLoaded($uid, $cat, $key)) {
|
||||
$this->load($uid, $cat);
|
||||
}
|
||||
|
||||
|
@ -92,7 +97,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!$this->config_loaded) {
|
||||
if ($this->isLoaded($uid, $cat, $key)) {
|
||||
$this->load($uid, $cat);
|
||||
}
|
||||
// We store our setting values as strings.
|
||||
|
@ -121,7 +126,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!$this->config_loaded) {
|
||||
if (!$this->isLoaded($uid, $cat, $key)) {
|
||||
$this->load($uid, $cat);
|
||||
}
|
||||
|
||||
|
@ -139,6 +144,6 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->config_loaded;
|
||||
return isset($this->config_loaded[$uid]) && $this->config_loaded[$uid];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue