]> git.mxchange.org Git - friendica.git/commitdiff
set config_loaded with uid
authorPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 13:34:30 +0000 (14:34 +0100)
committerPhilipp Holzer <admin@philipp.info>
Mon, 18 Feb 2019 13:34:30 +0000 (14:34 +0100)
src/Core/Config/Adapter/PreloadPConfigAdapter.php

index 5c736b2fff2de2ff84696d53d807519e986cfeab..72266744f24264f41f6a1c94fadf9f5cc1f4ec8e 100644 (file)
@@ -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];
        }
 }