2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Contracts\Backups;
|
|
|
|
|
|
2026-10-11 09:31:53 -04:00
|
|
|
use Illuminate\Validation\ValidationException;
|
2026-10-11 23:50:53 -04:00
|
|
|
use Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Models\Backup;
|
|
|
|
|
use Pterodactyl\Models\Server;
|
2026-10-11 23:50:53 -04:00
|
|
|
use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException;
|
|
|
|
|
use Throwable;
|
2026-10-05 18:10:18 -04:00
|
|
|
|
|
|
|
|
interface InitiatesBackups
|
|
|
|
|
{
|
2026-10-11 23:50:53 -04:00
|
|
|
/** A locked backup cannot be deleted by users or by automated processes. */
|
2026-10-05 18:10:18 -04:00
|
|
|
public function setIsLocked(bool $isLocked): self;
|
|
|
|
|
|
2026-10-11 09:31:53 -04:00
|
|
|
/**
|
|
|
|
|
* The files and folders to leave out of the backup. Empty entries are dropped.
|
|
|
|
|
*
|
|
|
|
|
* @param list<string>|null $ignored
|
|
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
public function setIgnoredFiles(?array $ignored): self;
|
|
|
|
|
|
2026-10-11 09:31:53 -04:00
|
|
|
/**
|
2026-10-11 23:50:53 -04:00
|
|
|
* Start a backup of the server on Wings. The name and the ignored files are validated here:
|
|
|
|
|
* a name is at most 191 characters, and the ignored files are a list of strings, reported
|
|
|
|
|
* under `ignored_files`. A name left out or blank becomes one with the time the backup
|
|
|
|
|
* started.
|
2026-10-11 09:31:53 -04:00
|
|
|
*
|
2026-10-11 23:50:53 -04:00
|
|
|
* With $override, a server at its backup limit rotates out its oldest unlocked backups once
|
|
|
|
|
* Wings accepts the new one. A backup Wings rejects is marked failed and nothing is rotated
|
|
|
|
|
* out.
|
|
|
|
|
*
|
|
|
|
|
* @throws TooManyBackupsException
|
|
|
|
|
* @throws TooManyRequestsHttpException
|
2026-10-11 09:31:53 -04:00
|
|
|
* @throws ValidationException
|
2026-10-11 23:50:53 -04:00
|
|
|
* @throws Throwable
|
2026-10-11 09:31:53 -04:00
|
|
|
*/
|
2026-10-05 18:10:18 -04:00
|
|
|
public function initiate(Server $server, ?string $name = null, bool $override = false): Backup;
|
|
|
|
|
}
|