mirror of
https://github.com/pelican-dev/panel.git
synced 2026-07-25 08:33:58 +03:00
Backups now record whether they were initiated by a schedule task via a new is_scheduled column, set by CreateBackupSchema through the initiate service. The per-user setting splits into manual_backup_notifications and scheduled_backup_notifications, both opt-in, so users can subscribe to each kind independently. The upgrade seeding grants owners both. The backup origin is also exposed in the client API transformer.
32 lines
748 B
PHP
32 lines
748 B
PHP
<?php
|
|
|
|
namespace App\Enums;
|
|
|
|
enum ServerUserSettingKey: string
|
|
{
|
|
case ManualBackupNotifications = 'manual_backup_notifications';
|
|
case ScheduledBackupNotifications = 'scheduled_backup_notifications';
|
|
|
|
/**
|
|
* The default value for users without an explicit setting.
|
|
*/
|
|
public function getDefaultValue(): bool
|
|
{
|
|
return match ($this) {
|
|
self::ManualBackupNotifications, self::ScheduledBackupNotifications => false,
|
|
};
|
|
}
|
|
|
|
/** @return array<string, bool> */
|
|
public static function getDefaultSettings(): array
|
|
{
|
|
$default = [];
|
|
|
|
foreach (self::cases() as $key) {
|
|
$default[$key->value] = $key->getDefaultValue();
|
|
}
|
|
|
|
return $default;
|
|
}
|
|
}
|