mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
backend: support is_successful state for backups rather than deleting it when failing
This allows the UI to correctly show failed backups to the user and require them to manually delete those backups, rather than them mysteriously disappearing. We can also hook into this later to send a notification to the user when the backup fails.
This commit is contained in:
@@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @property int $id
|
||||
* @property int $server_id
|
||||
* @property int $uuid
|
||||
* @property bool $is_successful
|
||||
* @property string $name
|
||||
* @property string[] $ignored_files
|
||||
* @property string $disk
|
||||
@@ -44,6 +45,7 @@ class Backup extends Model
|
||||
*/
|
||||
protected $casts = [
|
||||
'id' => 'int',
|
||||
'is_successful' => 'bool',
|
||||
'bytes' => 'int',
|
||||
'ignored_files' => 'array',
|
||||
];
|
||||
@@ -59,6 +61,7 @@ class Backup extends Model
|
||||
* @var array
|
||||
*/
|
||||
protected $attributes = [
|
||||
'is_successful' => true,
|
||||
'sha256_hash' => null,
|
||||
'bytes' => 0,
|
||||
];
|
||||
@@ -69,6 +72,7 @@ class Backup extends Model
|
||||
public static $validationRules = [
|
||||
'server_id' => 'bail|required|numeric|exists:servers,id',
|
||||
'uuid' => 'required|uuid',
|
||||
'is_successful' => 'boolean',
|
||||
'name' => 'required|string',
|
||||
'ignored_files' => 'array',
|
||||
'disk' => 'required|string',
|
||||
|
||||
Reference in New Issue
Block a user