]> git.mxchange.org Git - friendica.git/commitdiff
Bugfixing PConfig
authorPhilipp Holzer <admin@philipp.info>
Sun, 3 Feb 2019 22:22:05 +0000 (23:22 +0100)
committerPhilipp Holzer <admin@philipp.info>
Sun, 3 Feb 2019 22:22:05 +0000 (23:22 +0100)
src/App.php
src/Core/Config/ConfigCache.php
src/Core/Config/PreloadPConfigAdapter.php
src/Factory/ConfigFactory.php

index 79e84287051fa88d06aed532550bf2c6e8b0c78e..5d557738da7c1ae219c59c36aa054f003be0e842 100644 (file)
@@ -375,7 +375,7 @@ class App
                        $adapterType = $this->config->get('system', 'config_adapter');
                        $adapter = ConfigFactory::createConfig($adapterType, $this->config);
                        Core\Config::setAdapter($adapter);
-                       $adapterP = ConfigFactory::createConfig($adapterType, $this->config);
+                       $adapterP = ConfigFactory::createPConfig($adapterType, $this->config);
                        Core\PConfig::setAdapter($adapterP);
                        Core\Config::load();
                }
index d7318537e927b7a5d1c0fb2dceb7f6f245e5083b..b50ba3e00450eaf40bf8d177d1164960325ac8d3 100644 (file)
@@ -121,7 +121,7 @@ class ConfigCache implements IConfigCache, IPConfigCache
 
                if (isset($this->config[$uid][$cat][$key])) {
                        $return = $this->config[$uid][$cat][$key];
-               } elseif ($key == null && isset($this->config[$uid][$cat])) {
+               } elseif ($key === null && isset($this->config[$uid][$cat])) {
                        $return = $this->config[$uid][$cat];
                }
 
index 311518bbe94037324f9b637f2d77ba29a33b9a01..ed18bdf2e7dc01e7fa9c05aac4db0698b76ceda0 100644 (file)
@@ -23,13 +23,15 @@ class PreloadPConfigAdapter implements IPConfigAdapter
        private $config;
 
        /**
-        * @param int           $uid    The UID of the current user
         * @param IPConfigCache $config The config cache of this adapter
+        * @param int           $uid    The UID of the current user
         */
-       public function __construct($uid, $config)
+       public function __construct($config, $uid = null)
        {
                $this->config = $config;
-               $this->load($uid, 'config');
+               if (isset($uid)) {
+                       $this->load($uid, 'config');
+               }
        }
 
        public function load($uid, $family)
index 4ab20d1d565afcfbce1917cff9f136cd178a01be..46d55b30c3a80d2926e8303bbe7fef142cdeb451 100644 (file)
@@ -36,15 +36,15 @@ class ConfigFactory
 
        /**
         * @param string               $type   The adapter type
-        * @param int                  $uid    The UID of the current user
         * @param Config\IPConfigCache $config The config cache of this adapter
+        * @param int                  $uid    The UID of the current user
         *
         * @return Config\IPConfigAdapter
         */
-       public static function createPConfig($type, $uid, $config)
+       public static function createPConfig($type, $config, $uid = null)
        {
                if ($type == 'preload') {
-                       return new Config\PreloadPConfigAdapter($uid, $config);
+                       return new Config\PreloadPConfigAdapter($config, $uid);
                } else {
                        return new Config\JITPConfigAdapter($config);
                }