Skip to content

Commit 283e0f7

Browse files
committed
Move language caching into installation cache
1 parent 76cb99d commit 283e0f7

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

app/Core/HttpKernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,11 @@ public function getApplication(): \Leantime\Core\Application
154154
public function getMiddleware(): array
155155
{
156156
return self::dispatch_filter('http_middleware', [
157-
Middleware\StartSession::class,
158157
Middleware\TrustProxies::class,
159158
Middleware\InitialHeaders::class,
160159
Middleware\Installed::class,
161160
Middleware\Updated::class,
161+
Middleware\StartSession::class,
162162
Middleware\RequestRateLimiter::class,
163163
$this->app->make(IncomingRequest::class) instanceof ApiRequest
164164
? Middleware\ApiAuth::class

app/Core/Language.php

+10-9
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Leantime\Core;
44

55
use Exception;
6+
use Illuminate\Support\Facades\Cache;
67
use Illuminate\Support\Str;
78
use Symfony\Component\HttpFoundation\Cookie;
89
use Symfony\Component\HttpFoundation\Response;
@@ -167,14 +168,14 @@ public function isValidLanguage(string $langCode): bool
167168
*/
168169
public function readIni(): array
169170
{
170-
if (session()->exists('cache.language_resources_' . $this->language) && $this->config->debug == 0) {
171-
$this->ini_array = session(['cache.language_resources_' . $this->language => self::dispatch_filter(
171+
if (Cache::store('installation')->has('cache.language_resources_' . $this->language) && $this->config->debug == 0) {
172+
$this->ini_array = Cache::store('installation')->set('cache.language_resources_' . $this->language, self::dispatch_filter(
172173
'language_resources',
173-
session('cache.language_resources_' . $this->language),
174+
Cache::store('installation')->get('cache.language_resources_' . $this->language),
174175
[
175176
'language' => $this->language,
176177
]
177-
)]);
178+
));
178179
return $this->ini_array;
179180
}
180181

@@ -206,7 +207,7 @@ public function readIni(): array
206207
]
207208
);
208209

209-
session(['cache.language_resources_' . $this->language => $this->ini_array]);
210+
Cache::store("installation")->set('cache.language_resources_' . $this->language, $this->ini_array);
210211

211212
return $this->ini_array;
212213
}
@@ -254,8 +255,8 @@ protected function includeOverrides(array $language, string $filepath, bool $for
254255
*/
255256
public function getLanguageList(): bool|array
256257
{
257-
if (session()->exists("cache.langlist")) {
258-
return session("cache.langlist");
258+
if (Cache::store('installation')->has("cache.langlist")) {
259+
return Cache::store('installation')->get("cache.langlist");
259260
}
260261

261262
$langlist = false;
@@ -276,9 +277,9 @@ public function getLanguageList(): bool|array
276277
}
277278

278279
$parsedLangList = self::dispatch_filter('languages', $langlist);
279-
session(["cache.langlist" => $parsedLangList]);
280+
Cache::store('installation')->set("cache.langlist", $parsedLangList);
280281

281-
return session("cache.langlist");
282+
return $parsedLangList;
282283
}
283284

284285
/**

0 commit comments

Comments
 (0)