RestoreFromUpload
in package
Use case for restoring database from uploaded file.
Tags
Table of Contents
Constants
- MAX_UPLOAD_SIZE = 200 * 1024 * 1024
- Hard cap on the uploaded backup file (compressed bytes on disk).
Properties
Methods
- __construct() : mixed
- Constructor.
- execute() : array{success: bool, error: ?string}
- Execute the use case.
Constants
MAX_UPLOAD_SIZE
Hard cap on the uploaded backup file (compressed bytes on disk).
public
mixed
MAX_UPLOAD_SIZE
= 200 * 1024 * 1024
200 MB of gzipped SQL is far above any plausible legitimate LWT backup. The decompressed-bytes cap in Restore::restoreFile is the deeper defense; this stops the worker from buffering an obviously hostile upload before we even open it.
Properties
$repository
private
BackupRepositoryInterface
$repository
Methods
__construct()
Constructor.
public
__construct(BackupRepositoryInterface $repository) : mixed
Parameters
- $repository : BackupRepositoryInterface
-
Backup repository
execute()
Execute the use case.
public
execute(array{name: string, type: string, tmp_name: string, error: int, size: int}|null $fileData) : array{success: bool, error: ?string}
Parameters
- $fileData : array{name: string, type: string, tmp_name: string, error: int, size: int}|null
-
Validated file data from InputValidator::getUploadedFile()