]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Config/JitPConfiguration.php
Merge pull request #7754 from annando/aria
[friendica.git] / src / Core / Config / JitPConfiguration.php
index 8ad65eff1a93a01f7c1e43d2f478c26ef44814fc..fb5c9d1a9845dcc8dfb2dda7db27edd3c0eeea35 100644 (file)
@@ -34,8 +34,8 @@ class JitPConfiguration extends PConfiguration
         */
        public function load(int $uid, string $cat = 'config')
        {
-               // If not connected, do nothing
-               if (!$this->configModel->isConnected()) {
+               // If not connected or no uid, do nothing
+               if (!$uid || !$this->configModel->isConnected()) {
                        return;
                }
 
@@ -56,6 +56,10 @@ class JitPConfiguration extends PConfiguration
         */
        public function get(int $uid, string $cat, string $key, $default_value = null, bool $refresh = false)
        {
+               if (!$uid) {
+                       return $default_value;
+               }
+
                // if the value isn't loaded or refresh is needed, load it to the cache
                if ($this->configModel->isConnected() &&
                    (empty($this->db_loaded[$uid][$cat][$key]) ||
@@ -82,6 +86,10 @@ class JitPConfiguration extends PConfiguration
         */
        public function set(int $uid, string $cat, string $key, $value)
        {
+               if (!$uid) {
+                       return false;
+               }
+
                // set the cache first
                $cached = $this->configCache->set($uid, $cat, $key, $value);
 
@@ -102,6 +110,10 @@ class JitPConfiguration extends PConfiguration
         */
        public function delete(int $uid, string $cat, string $key)
        {
+               if (!$uid) {
+                       return false;
+               }
+
                $cacheRemoved = $this->configCache->delete($uid, $cat, $key);
 
                if (isset($this->db_loaded[$uid][$cat][$key])) {