2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Actions\Files;
|
|
|
|
|
|
2026-10-11 16:09:53 -04:00
|
|
|
use Illuminate\Support\Fluent;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Contracts\Files\ReadsFileContents;
|
|
|
|
|
use Pterodactyl\Facades\Daemon;
|
|
|
|
|
use Pterodactyl\Models\Server;
|
|
|
|
|
|
|
|
|
|
final readonly class ReadFileContents implements ReadsFileContents
|
|
|
|
|
{
|
|
|
|
|
public function read(Server $server, string $path, ?int $maxBytes = null): string
|
|
|
|
|
{
|
|
|
|
|
return Daemon::server($server)->files()->getContent(
|
|
|
|
|
$path,
|
2026-10-11 16:09:53 -04:00
|
|
|
$maxBytes ?? Fluent::make(config()->array('pterodactyl.files'))->integer('max_edit_size')
|
2026-10-05 18:10:18 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|