X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FConfig%2FJitPConfiguration.php;h=fb5c9d1a9845dcc8dfb2dda7db27edd3c0eeea35;hb=cbe435bb708ccf17a4b5bea1e20c3258c9524700;hp=8ad65eff1a93a01f7c1e43d2f478c26ef44814fc;hpb=9d98a4ce3a146e465fe0453aa71c8a84e6f007dc;p=friendica.git diff --git a/src/Core/Config/JitPConfiguration.php b/src/Core/Config/JitPConfiguration.php index 8ad65eff1a..fb5c9d1a98 100644 --- a/src/Core/Config/JitPConfiguration.php +++ b/src/Core/Config/JitPConfiguration.php @@ -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])) {