@@ -58,6 +58,7 @@ public function loadUserPreferences(bool $isMinimumCommon = false): void
5858 return ;
5959 }
6060
61+ /** @var mixed[] $configData */
6162 $ configData = $ _SESSION ['cache ' ][$ cacheKey ]['userprefs ' ];
6263 // type is 'db' or 'session'
6364 $ this ->storageType = $ _SESSION ['cache ' ][$ cacheKey ]['userprefs_type ' ];
@@ -88,11 +89,11 @@ public function loadUserPreferences(bool $isMinimumCommon = false): void
8889 && $ configData ['ThemeDefault ' ] !== $ this ->themeManager ->theme ->getId ()
8990 ) {
9091 $ this ->setUserValue (
91- null ,
9292 'ThemeDefault ' ,
9393 $ this ->themeManager ->theme ->getId (),
9494 'original ' ,
9595 );
96+ $ this ->updateConfigValue ('ThemeDefault ' , $ this ->themeManager ->theme ->getId ());
9697 }
9798 } elseif (
9899 $ this ->config ->config ->ThemeDefault !== $ this ->themeManager ->theme ->getId ()
@@ -111,7 +112,7 @@ public function loadUserPreferences(bool $isMinimumCommon = false): void
111112 || isset ($ configData ['lang ' ])
112113 && Current::$ lang !== $ configData ['lang ' ]
113114 ) {
114- $ this ->setUserValue (null , 'lang ' , Current::$ lang , 'en ' );
115+ $ this ->setUserValue ('lang ' , Current::$ lang , 'en ' );
115116 }
116117 } elseif (isset ($ configData ['lang ' ])) {
117118 // read language from settings
@@ -151,17 +152,12 @@ public function getLoginCookieValidityFromCache(int $server): void
151152 * If user preferences are not yet initialized, option is applied to
152153 * global config and added to a update queue, which is processed
153154 * by {@link loadUserPreferences()}
154- *
155- * @param string|null $cookieName can be null
156- * @param string $cfgPath configuration path
157- * @param mixed $newCfgValue new value
158- * @param string|null $defaultValue default value
159155 */
160156 public function setUserValue (
161- string |null $ cookieName ,
162157 string $ cfgPath ,
163158 mixed $ newCfgValue ,
164159 string |null $ defaultValue = null ,
160+ string $ cookieName = '' ,
165161 ): true |Message {
166162 $ result = true ;
167163 // use permanent user preferences if possible
@@ -173,7 +169,7 @@ public function setUserValue(
173169 $ result = $ this ->userPreferences ->persistOption ($ cfgPath , $ newCfgValue , $ defaultValue );
174170 }
175171
176- if ($ this ->storageType !== 'db ' && $ cookieName ) {
172+ if ($ this ->storageType !== 'db ' && $ cookieName !== '' ) {
177173 // fall back to cookies
178174 if ($ defaultValue === null ) {
179175 $ defaultValue = Core::arrayRead ($ cfgPath , $ this ->config ->settings );
@@ -182,11 +178,14 @@ public function setUserValue(
182178 $ this ->config ->setCookie ($ cookieName , (string ) $ newCfgValue , $ defaultValue );
183179 }
184180
185- $ this ->config ->set ($ cfgPath , $ newCfgValue );
186-
187181 return $ result ;
188182 }
189183
184+ public function updateConfigValue (string $ cfgPath , mixed $ newCfgValue ): void
185+ {
186+ $ this ->config ->set ($ cfgPath , $ newCfgValue );
187+ }
188+
190189 /**
191190 * Reads value stored by {@link setUserValue()}
192191 *
0 commit comments