set config_loaded with uid
This commit is contained in:
parent
f825fa1d1c
commit
1194e9b41e
@ -13,7 +13,10 @@ use Friendica\Database\DBA;
|
|||||||
*/
|
*/
|
||||||
class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfigAdapter
|
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
|
* @param int $uid The UID of the current user
|
||||||
@ -25,6 +28,8 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
if (isset($uid)) {
|
if (isset($uid)) {
|
||||||
$this->load($uid, 'config');
|
$this->load($uid, 'config');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->config_loaded = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,11 +39,11 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
{
|
{
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
if ($this->config_loaded) {
|
if (empty($uid)) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($uid)) {
|
if ($this->isLoaded($uid, $cat, null)) {
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +58,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
}
|
}
|
||||||
DBA::close($pconfigs);
|
DBA::close($pconfigs);
|
||||||
|
|
||||||
$this->config_loaded = true;
|
$this->config_loaded[$uid] = true;
|
||||||
|
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
@ -67,7 +72,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
return '!<unset>!';
|
return '!<unset>!';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->config_loaded) {
|
if (!$this->isLoaded($uid, $cat, $key)) {
|
||||||
$this->load($uid, $cat);
|
$this->load($uid, $cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,7 +97,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->config_loaded) {
|
if ($this->isLoaded($uid, $cat, $key)) {
|
||||||
$this->load($uid, $cat);
|
$this->load($uid, $cat);
|
||||||
}
|
}
|
||||||
// We store our setting values as strings.
|
// We store our setting values as strings.
|
||||||
@ -121,7 +126,7 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->config_loaded) {
|
if (!$this->isLoaded($uid, $cat, $key)) {
|
||||||
$this->load($uid, $cat);
|
$this->load($uid, $cat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,6 +144,6 @@ class PreloadPConfigAdapter extends AbstractDbaConfigAdapter implements IPConfig
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->config_loaded;
|
return isset($this->config_loaded[$uid]) && $this->config_loaded[$uid];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user