Skip to content

Commit 838b9a9

Browse files
committed
Add support for filesystem caching, closes pterodactyl#993
1 parent ab2973c commit 838b9a9

File tree

4 files changed

+5
-11
lines changed

4 files changed

+5
-11
lines changed

app/Console/Commands/Environment/AppSettingsCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class AppSettingsCommand extends Command
2222
const ALLOWED_CACHE_DRIVERS = [
2323
'redis' => 'Redis (recommended)',
2424
'memcached' => 'Memcached',
25+
'file' => 'Filesystem',
2526
];
2627

2728
const ALLOWED_SESSION_DRIVERS = [

app/Http/Controllers/Admin/NodesController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public function delete($node)
366366
public function setToken(Node $node)
367367
{
368368
$token = bin2hex(random_bytes(16));
369-
$this->cache->tags(['Node:Configuration'])->put($token, $node->id, 5);
369+
$this->cache->put('Node:Configuration:' . $token, $node->id, 5);
370370

371371
return response()->json(['token' => $token]);
372372
}

app/Http/Controllers/Daemon/ActionController.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
<?php
2-
/**
3-
* Pterodactyl - Panel
4-
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5-
*
6-
* This software is licensed under the terms of the MIT license.
7-
* https://opensource.org/licenses/MIT
8-
*/
92

103
namespace Pterodactyl\Http\Controllers\Daemon;
114

@@ -25,7 +18,7 @@ class ActionController extends Controller
2518
*/
2619
public function authenticateDownload(Request $request)
2720
{
28-
$download = Cache::tags(['Server:Downloads'])->pull($request->input('token'));
21+
$download = Cache::pull('Server:Downloads:' . $request->input('token'));
2922

3023
if (is_null($download)) {
3124
return response()->json([
@@ -78,7 +71,7 @@ public function markInstall(Request $request)
7871
*/
7972
public function configuration(Request $request, $token)
8073
{
81-
$nodeId = Cache::tags(['Node:Configuration'])->pull($token);
74+
$nodeId = Cache::pull('Node:Configuration:' . $token);
8275
if (is_null($nodeId)) {
8376
return response()->json(['error' => 'token_invalid'], 403);
8477
}

app/Http/Controllers/Server/Files/DownloadController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function index(Request $request, string $uuid, string $file): RedirectRes
4848

4949
$token = str_random(40);
5050
$node = $server->getRelation('node');
51-
$this->cache->tags(['Server:Downloads'])->put($token, ['server' => $server->uuid, 'path' => $file], 5);
51+
$this->cache->put('Server:Downloads:' . $token, ['server' => $server->uuid, 'path' => $file], 5);
5252

5353
return redirect(sprintf('%s://%s:%s/v1/server/file/download/%s', $node->scheme, $node->fqdn, $node->daemonListen, $token));
5454
}

0 commit comments

Comments
 (0)