mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-25 02:10:39 +00:00
ability to download log from admin
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Domain\Settings\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Symfony\Component\HttpFoundation\BinaryFileResponse;
|
||||
|
||||
class DownloadLogController extends Controller
|
||||
{
|
||||
public function __invoke($log): Response|BinaryFileResponse|Application|ResponseFactory
|
||||
{
|
||||
if (is_demo()) {
|
||||
return response('Done.', 204);
|
||||
}
|
||||
|
||||
// Get log path
|
||||
$logPath = storage_path("logs/$log");
|
||||
|
||||
// Download log
|
||||
return response()->download(
|
||||
storage_path("logs/$log"), $log, [
|
||||
'Accept-Ranges' => 'bytes',
|
||||
'Content-Type' => 'text/plain',
|
||||
'Content-Length' => File::size($logPath),
|
||||
'Content-Range' => 'bytes 0-600/' . File::size($logPath),
|
||||
'Content-Disposition' => "attachment; filename=$log",
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,9 @@ class GetServerStatusController
|
||||
// Get server data
|
||||
$status = ($this->getServerSetupStatus)();
|
||||
|
||||
// Get latest logs
|
||||
$status['logs'] = getListOfLatestLogs();
|
||||
|
||||
// Add latest database backups
|
||||
$status['backups'] = collect(Storage::allFiles('app-backup'))
|
||||
->map(fn ($path) => str_replace('app-backup/', '', $path))
|
||||
|
||||
Reference in New Issue
Block a user