From 1194e9b41ea21db22ffde4da8eff66fd4d507c6f Mon Sep 17 00:00:00 2001 From: Philipp Holzer Date: Mon, 18 Feb 2019 14:34:30 +0100 Subject: [PATCH] set config_loaded with uid --- .../Config/Adapter/PreloadPConfigAdapter.php | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Core/Config/Adapter/PreloadPConfigAdapter.php b/src/Core/Config/Adapter/PreloadPConfigAdapter.php index 5c736b2ff..72266744f 100644 --- a/src/Core/Config/Adapter/PreloadPConfigAdapter.php +++ b/src/Core/Config/Adapter/PreloadPConfigAdapter.php @@ -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 '!!'; } - 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]; } }