From e7073ac2a2c0fd5dad2f9c83ade98c562d8306e8 Mon Sep 17 00:00:00 2001 From: robert dennis <31261583+robertdrakedennis@users.noreply.github.com> Date: Sun, 11 Oct 2026 23:50:53 -0400 Subject: [PATCH] action docblocks --- app/Actions/Activity/IngestActivityLogs.php | 16 ++------- app/Actions/Allocations/AssignAllocation.php | 5 --- .../Allocations/AssignAvailableAllocation.php | 2 -- app/Actions/Allocations/CreateAllocations.php | 16 +-------- app/Actions/Allocations/DeleteAllocation.php | 5 --- .../Allocations/UnassignAllocation.php | 3 -- app/Actions/Api/CreateAccountApiKey.php | 8 +---- app/Actions/Api/CreateApiKey.php | 13 +++----- app/Actions/Api/UpdateApiKey.php | 6 ---- app/Actions/Backups/CompleteBackup.php | 23 +------------ app/Actions/Backups/DeleteBackup.php | 12 +------ .../Backups/GenerateBackupDownloadLink.php | 8 ----- app/Actions/Backups/InitiateBackup.php | 33 ++----------------- app/Actions/Backups/PresignBackupUpload.php | 8 ----- app/Actions/Backups/RestoreBackup.php | 10 +----- app/Actions/Databases/CreateDatabase.php | 9 +---- app/Actions/Databases/CreateDatabaseHost.php | 15 +-------- app/Actions/Databases/DeleteDatabase.php | 2 -- app/Actions/Databases/DeleteDatabaseHost.php | 5 --- .../Databases/DeployServerDatabase.php | 15 +-------- .../Databases/RotateDatabasePassword.php | 2 -- app/Actions/Databases/UpdateDatabaseHost.php | 8 ----- app/Actions/Eggs/CreateEgg.php | 11 ++----- app/Actions/Eggs/DeleteEgg.php | 7 ---- .../Eggs/Scripts/UpdateInstallScript.php | 15 +-------- app/Actions/Eggs/Sharing/ExportEgg.php | 6 ---- app/Actions/Eggs/Sharing/ImportEgg.php | 3 -- .../Eggs/Sharing/UpdateEggFromImport.php | 3 -- app/Actions/Eggs/UpdateEgg.php | 5 --- .../Eggs/Variables/CreateEggVariable.php | 11 ++----- .../Eggs/Variables/DeleteEggVariable.php | 3 -- .../Eggs/Variables/ReorderEggVariables.php | 10 +----- .../Eggs/Variables/UpdateEggVariable.php | 5 --- .../ReplaceExtensionSettingFile.php | 3 -- .../Extensions/UpdateExtensionSettings.php | 4 --- app/Actions/Files/ChangeFilePermissions.php | 1 - app/Actions/Files/CompressFiles.php | 4 --- app/Actions/Files/DeleteFiles.php | 1 - app/Actions/Files/PullFile.php | 1 - app/Actions/Files/RenameFiles.php | 1 - app/Actions/Locations/CreateLocation.php | 6 +--- app/Actions/Locations/DeleteLocation.php | 5 --- app/Actions/Locations/UpdateLocation.php | 3 -- app/Actions/Mounts/AttachEggsToMount.php | 16 ++------- app/Actions/Mounts/AttachNodesToMount.php | 16 ++------- app/Actions/Mounts/CreateMount.php | 13 +++----- app/Actions/Mounts/DeleteMount.php | 3 -- app/Actions/Mounts/DetachEggFromMount.php | 3 -- app/Actions/Mounts/DetachNodeFromMount.php | 3 -- app/Actions/Mounts/UpdateMount.php | 3 -- app/Actions/Nodes/CreateNode.php | 9 ++--- app/Actions/Nodes/DeleteNode.php | 5 --- app/Actions/Nodes/ResetServerStates.php | 7 ---- app/Actions/Nodes/UpdateNode.php | 8 ----- app/Actions/Schedules/CreateSchedule.php | 11 +------ app/Actions/Schedules/CreateScheduleTask.php | 14 +------- app/Actions/Schedules/DeleteScheduleTask.php | 6 ---- app/Actions/Schedules/ProcessSchedule.php | 5 --- app/Actions/Schedules/UpdateSchedule.php | 5 --- app/Actions/Schedules/UpdateScheduleTask.php | 10 ------ app/Actions/Servers/ChangeServerEgg.php | 4 --- app/Actions/Servers/CreateServer.php | 22 ++----------- app/Actions/Servers/DeleteServer.php | 5 --- .../Servers/RecordServerInstallResult.php | 4 +-- app/Actions/Servers/ReinstallServer.php | 5 --- .../Servers/ToggleServerInstallStatus.php | 6 ---- .../Servers/ToggleServerSuspension.php | 2 -- app/Actions/Servers/UpdateServerBuild.php | 12 +------ app/Actions/Servers/UpdateServerDetails.php | 10 +----- .../Servers/UpdateServerDockerImage.php | 8 ----- app/Actions/Servers/UpdateServerStartup.php | 12 ++----- app/Actions/Subusers/CreateSubuser.php | 17 +--------- app/Actions/Subusers/DeleteSubuser.php | 6 ---- app/Actions/Subusers/UpdateSubuser.php | 9 ----- app/Actions/Tags/CreateTag.php | 9 ++--- app/Actions/Tags/DeleteTag.php | 9 ++--- app/Actions/Tags/SyncTags.php | 13 ++------ app/Actions/Tags/UpdateTag.php | 11 ++----- app/Actions/Themes/ApplyTheme.php | 1 - app/Actions/Themes/ResetTheme.php | 1 - app/Actions/Transfers/CompleteTransfer.php | 6 ---- app/Actions/Transfers/FailTransfer.php | 6 ---- app/Actions/Transfers/InitiateTransfer.php | 22 ++----------- app/Actions/Users/CreateSshKey.php | 5 +-- app/Actions/Users/CreateUser.php | 16 ++------- app/Actions/Users/DeleteUser.php | 5 --- app/Actions/Users/SetupTwoFactor.php | 7 ---- app/Actions/Users/ToggleTwoFactor.php | 16 --------- app/Actions/Users/UpdateUser.php | 9 ----- app/Actions/Users/UpdateUserEmail.php | 3 -- app/Actions/Users/UpdateUserPassword.php | 4 --- .../Activity/IngestsActivityLogs.php | 7 ++-- .../Allocations/CreatesAllocations.php | 5 ++- .../Allocations/DeletesAllocations.php | 2 +- app/Contracts/Api/CreatesAccountApiKeys.php | 7 ++-- app/Contracts/Api/CreatesApiKeys.php | 9 +++-- app/Contracts/Api/UpdatesApiKeys.php | 5 ++- app/Contracts/Backups/CompletesBackups.php | 8 ++--- app/Contracts/Backups/DeletesBackups.php | 6 +++- .../Backups/GeneratesBackupDownloadLinks.php | 4 +++ app/Contracts/Backups/InitiatesBackups.php | 19 ++++++++--- .../Backups/PresignsBackupUploads.php | 7 +++- app/Contracts/Backups/RestoresBackups.php | 7 +++- app/Contracts/Core/ReceivesEvents.php | 3 -- .../Databases/CreatesDatabaseHosts.php | 7 ++-- app/Contracts/Databases/CreatesDatabases.php | 7 ++-- .../Databases/DeletesDatabaseHosts.php | 6 +++- .../Databases/DeploysServerDatabases.php | 7 ++-- .../Databases/UpdatesDatabaseHosts.php | 9 +++-- app/Contracts/Eggs/CreatesEggVariables.php | 7 ++-- app/Contracts/Eggs/CreatesEggs.php | 10 +++--- app/Contracts/Eggs/DeletesEggVariables.php | 3 -- app/Contracts/Eggs/DeletesEggs.php | 4 +-- app/Contracts/Eggs/ReordersEggVariables.php | 4 +-- .../Eggs/UpdatesEggInstallScripts.php | 3 +- app/Contracts/Eggs/UpdatesEggVariables.php | 7 ++-- app/Contracts/Eggs/UpdatesEggs.php | 9 +++-- app/Contracts/Extensions/HashidsInterface.php | 6 +--- .../Extensions/InstallsExtensions.php | 3 +- .../Http/ClientPermissionsRequest.php | 6 +--- app/Contracts/Locations/CreatesLocations.php | 4 +-- app/Contracts/Locations/DeletesLocations.php | 2 +- app/Contracts/Locations/UpdatesLocations.php | 4 +-- app/Contracts/Mounts/AttachesEggsToMounts.php | 4 +-- .../Mounts/AttachesNodesToMounts.php | 4 +-- app/Contracts/Mounts/CreatesMounts.php | 5 ++- app/Contracts/Mounts/DeletesMounts.php | 3 -- .../Mounts/DetachesEggsFromMounts.php | 3 -- .../Mounts/DetachesNodesFromMounts.php | 3 -- app/Contracts/Mounts/UpdatesMounts.php | 7 ++-- app/Contracts/Nodes/CreatesNodes.php | 7 ++-- app/Contracts/Nodes/DeletesNodes.php | 2 +- app/Contracts/Nodes/UpdatesNodes.php | 16 ++++----- .../Schedules/CreatesScheduleTasks.php | 9 ++--- app/Contracts/Schedules/CreatesSchedules.php | 3 +- .../Schedules/DeletesScheduleTasks.php | 2 +- .../Schedules/ProcessesSchedules.php | 2 +- .../Schedules/UpdatesScheduleTasks.php | 9 ++--- app/Contracts/Schedules/UpdatesSchedules.php | 3 +- app/Contracts/Servers/CreatesServers.php | 10 +++--- app/Contracts/Servers/ReinstallsServers.php | 6 +++- .../Servers/TogglesServerSuspension.php | 2 ++ app/Contracts/Servers/UpdatesServerBuild.php | 10 +++--- .../Servers/UpdatesServerDetails.php | 7 ++-- .../Servers/UpdatesServerStartup.php | 10 +++--- app/Contracts/Subusers/CreatesSubusers.php | 12 +++---- app/Contracts/Subusers/DeletesSubusers.php | 2 +- app/Contracts/Subusers/UpdatesSubusers.php | 9 +++-- app/Contracts/Tags/CreatesTags.php | 2 +- app/Contracts/Tags/DeletesTags.php | 2 +- app/Contracts/Tags/SyncsTags.php | 3 +- app/Contracts/Tags/UpdatesTags.php | 7 ++-- app/Contracts/Themes/AppliesThemes.php | 1 + app/Contracts/Themes/ResetsThemes.php | 1 + .../Transfers/InitiatesTransfers.php | 13 ++++---- app/Contracts/Users/CreatesSshKeys.php | 6 ++-- app/Contracts/Users/CreatesUsers.php | 11 ++----- app/Contracts/Users/DeletesUsers.php | 2 +- app/Contracts/Users/TogglesTwoFactor.php | 2 +- app/Contracts/Users/UpdatesUserPasswords.php | 1 + app/Contracts/Users/UpdatesUsers.php | 9 ++--- 161 files changed, 260 insertions(+), 881 deletions(-) diff --git a/app/Actions/Activity/IngestActivityLogs.php b/app/Actions/Activity/IngestActivityLogs.php index 1413ca16d..1b56d347d 100644 --- a/app/Actions/Activity/IngestActivityLogs.php +++ b/app/Actions/Activity/IngestActivityLogs.php @@ -24,13 +24,7 @@ use Pterodactyl\Models\User; */ final class IngestActivityLogs implements IngestsActivityLogs { - /** - * The activity Wings reports, under the field names of its protocol: `data` lists the - * events, each naming the server it happened on, the event, its metadata and when it - * happened, and optionally the user who caused it and their IP address. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -46,8 +40,7 @@ final class IngestActivityLogs implements IngestsActivityLogs } /** - * Validates reported activity and returns the events it lists. Metadata given as null - * is empty. + * Metadata given as null is empty. * * @param array $input * @return list @@ -75,11 +68,6 @@ final class IngestActivityLogs implements IngestsActivityLogs return $events; } - /** - * @param array $input - * - * @throws ValidationException - */ public function ingest(Node $node, array $input): void { $events = self::events($input); diff --git a/app/Actions/Allocations/AssignAllocation.php b/app/Actions/Allocations/AssignAllocation.php index 1add5295a..ca2ddfaf9 100644 --- a/app/Actions/Allocations/AssignAllocation.php +++ b/app/Actions/Allocations/AssignAllocation.php @@ -10,16 +10,11 @@ use Pterodactyl\Contracts\Allocations\AssignsAvailableAllocations; use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Server; -use Throwable; final readonly class AssignAllocation implements AssignsAllocations { public function __construct(private AssignsAvailableAllocations $assignable) {} - /** - * @throws DisplayException - * @throws Throwable - */ public function assign(Server $server): Allocation { return DB::transaction(function () use ($server): Allocation { diff --git a/app/Actions/Allocations/AssignAvailableAllocation.php b/app/Actions/Allocations/AssignAvailableAllocation.php index f8c1259d1..623c254e3 100644 --- a/app/Actions/Allocations/AssignAvailableAllocation.php +++ b/app/Actions/Allocations/AssignAvailableAllocation.php @@ -8,7 +8,6 @@ use Illuminate\Support\Collection; use Pterodactyl\Contracts\Allocations\AssignsAvailableAllocations; use Pterodactyl\Contracts\Allocations\CreatesAllocations; use Pterodactyl\Data\AllocationRange; -use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\Service\Allocation\AutoAllocationNotEnabledException; use Pterodactyl\Exceptions\Service\Allocation\NoAutoAllocationSpaceAvailableException; use Pterodactyl\Facades\Activity; @@ -20,7 +19,6 @@ final readonly class AssignAvailableAllocation implements AssignsAvailableAlloca { public function __construct(private CreatesAllocations $allocations) {} - /** @throws DisplayException */ public function assignAvailable(Server $server): Allocation { throw_unless(config('pterodactyl.client_features.allocations.enabled'), AutoAllocationNotEnabledException::class); diff --git a/app/Actions/Allocations/CreateAllocations.php b/app/Actions/Allocations/CreateAllocations.php index 60d0d1e85..c32a844cc 100644 --- a/app/Actions/Allocations/CreateAllocations.php +++ b/app/Actions/Allocations/CreateAllocations.php @@ -51,12 +51,7 @@ final readonly class CreateAllocations implements CreatesAllocations }); } - /** - * The fields of the allocations to create on one address: an IP address, CIDR range or - * hostname, the ports and port ranges ("25565-25570") to open on it, and an optional alias. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -67,15 +62,6 @@ final readonly class CreateAllocations implements CreatesAllocations ]; } - /** - * @param array $input - * - * @throws DisplayException - * @throws CidrOutOfRangeException - * @throws InvalidPortMappingException - * @throws PortOutOfRangeException - * @throws TooManyPortsInRangeException - */ public function create(Node $node, array $input): void { $validated = Validator::make($input, self::rules())->safe(); diff --git a/app/Actions/Allocations/DeleteAllocation.php b/app/Actions/Allocations/DeleteAllocation.php index 82321e380..d3e5b2cd5 100644 --- a/app/Actions/Allocations/DeleteAllocation.php +++ b/app/Actions/Allocations/DeleteAllocation.php @@ -10,11 +10,6 @@ use Pterodactyl\Models\Allocation; final class DeleteAllocation implements DeletesAllocations { - /** - * Delete an allocation, provided no server is attached to it. - * - * @throws ServerUsingAllocationException - */ public function delete(Allocation $allocation): void { if ($allocation->server_id !== null) { diff --git a/app/Actions/Allocations/UnassignAllocation.php b/app/Actions/Allocations/UnassignAllocation.php index 8799a8413..6136ce0d6 100644 --- a/app/Actions/Allocations/UnassignAllocation.php +++ b/app/Actions/Allocations/UnassignAllocation.php @@ -12,9 +12,6 @@ use Pterodactyl\Models\Server; final class UnassignAllocation implements UnassignsAllocations { - /** - * @throws DisplayException - */ public function unassign(Server $server, Allocation $allocation): Allocation { throw_if(empty($server->allocation_limit), DisplayException::class, 'You cannot delete allocations for this server: no allocation limit is set.'); diff --git a/app/Actions/Api/CreateAccountApiKey.php b/app/Actions/Api/CreateAccountApiKey.php index ffeca88a1..3e7772099 100644 --- a/app/Actions/Api/CreateAccountApiKey.php +++ b/app/Actions/Api/CreateAccountApiKey.php @@ -17,12 +17,7 @@ final readonly class CreateAccountApiKey implements CreatesAccountApiKeys { use ValidatesAllowedIps; - /** - * An account API key's fields: its description, held to the rules of an API key's memo, - * and the IP addresses or CIDR ranges it may be used from. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { $rules = CreateApiKey::rules(); @@ -34,7 +29,6 @@ final readonly class CreateAccountApiKey implements CreatesAccountApiKeys ]; } - /** @param list|null $allowedIps */ public function create(User $user, ?string $description, ?array $allowedIps): NewAccessToken { $validator = Validator::make(['description' => $description, 'allowed_ips' => $allowedIps], self::rules()); diff --git a/app/Actions/Api/CreateApiKey.php b/app/Actions/Api/CreateApiKey.php index 852360c72..6ab7d9aa7 100644 --- a/app/Actions/Api/CreateApiKey.php +++ b/app/Actions/Api/CreateApiKey.php @@ -17,9 +17,8 @@ final readonly class CreateApiKey implements CreatesApiKeys use ValidatesAllowedIps; /** - * An API key's fields: its memo, the user it belongs to, and the IP addresses or CIDR - * ranges it may be used from. Each allowed IP must also parse as an address or a range - * (see ValidatesAllowedIps). + * Each allowed IP must also parse as an address or a range, which ValidatesAllowedIps checks + * once these rules pass. * * @return NormalizedValidationRules */ @@ -34,8 +33,8 @@ final readonly class CreateApiKey implements CreatesApiKeys } /** - * The resource permissions of an application key: an r_* column for each AdminAcl - * resource, holding AdminAcl::NONE or AdminAcl::READ and AdminAcl::WRITE combined. + * An r_* column for each AdminAcl resource, holding AdminAcl::NONE or AdminAcl::READ and + * AdminAcl::WRITE combined. * * @return NormalizedValidationRules */ @@ -49,10 +48,6 @@ final readonly class CreateApiKey implements CreatesApiKeys return $rules; } - /** - * @param array $input - * @param array $permissions - */ public function create(int $keyType, array $input, array $permissions = []): ApiKey { $validator = Validator::make($input, self::rules()); diff --git a/app/Actions/Api/UpdateApiKey.php b/app/Actions/Api/UpdateApiKey.php index 468bcfb43..4d643f850 100644 --- a/app/Actions/Api/UpdateApiKey.php +++ b/app/Actions/Api/UpdateApiKey.php @@ -10,12 +10,6 @@ use Pterodactyl\Models\ApiKey; final readonly class UpdateApiKey implements UpdatesApiKeys { - /** - * Update an API key's attributes without regenerating its token. - * - * @param array $input - * @param array $permissions - */ public function update(ApiKey $key, array $input, array $permissions = []): ApiKey { $attributes = Validator::validate($input, ['memo' => ['sometimes', ...CreateApiKey::rules()['memo']]]); diff --git a/app/Actions/Backups/CompleteBackup.php b/app/Actions/Backups/CompleteBackup.php index 86693dd62..0c1218aec 100644 --- a/app/Actions/Backups/CompleteBackup.php +++ b/app/Actions/Backups/CompleteBackup.php @@ -8,7 +8,6 @@ use Carbon\CarbonImmutable; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Validator; -use Illuminate\Validation\ValidationException; use Pterodactyl\Contracts\Backups\CompletesBackups; use Pterodactyl\Events\Server\OperationCompleted; use Pterodactyl\Exceptions\DisplayException; @@ -16,19 +15,12 @@ use Pterodactyl\Extensions\Backups\BackupManager; use Pterodactyl\Extensions\Filesystem\S3Filesystem; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Backup; -use Throwable; final readonly class CompleteBackup implements CompletesBackups { public function __construct(private BackupManager $backupManager) {} - /** - * The outcome Wings reports for a backup, under the field names of its protocol. A - * successful backup carries its checksum, the checksum's type and its size in bytes. An - * S3 backup may list the parts of its multipart upload. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -42,16 +34,6 @@ final readonly class CompleteBackup implements CompletesBackups ]; } - /** - * Records the outcome Wings reported for a backup and, for S3 storage, closes the - * multipart upload it belongs to. - * - * @param array $input - * - * @throws DisplayException - * @throws ValidationException - * @throws Throwable - */ public function complete(Backup $backup, array $input): void { $validated = Validator::make($input, self::rules())->safe(); @@ -90,9 +72,6 @@ final readonly class CompleteBackup implements CompletesBackups } /** - * Marks a multipart upload in a given S3-compatible instance as failed or successful for - * the given backup. - * * @param list|null $parts * * @throws DisplayException diff --git a/app/Actions/Backups/DeleteBackup.php b/app/Actions/Backups/DeleteBackup.php index d25ca22dd..77615fdfe 100644 --- a/app/Actions/Backups/DeleteBackup.php +++ b/app/Actions/Backups/DeleteBackup.php @@ -22,12 +22,6 @@ final readonly class DeleteBackup implements DeletesBackups private BackupManager $manager, ) {} - /** - * Deletes a backup from the system. If the backup is stored in S3 a request - * will be made to delete that backup from the disk as well. - * - * @throws Throwable - */ public function delete(Backup $backup): void { // If the backup is marked as failed it can still be deleted, even if locked @@ -59,11 +53,7 @@ final readonly class DeleteBackup implements DeletesBackups ->log(); } - /** - * Deletes a backup's archive from an S3 disk. - * - * @throws Throwable - */ + /** @throws Throwable */ private function deleteFromS3(Backup $backup): void { $adapter = $this->manager->adapter(Backup::ADAPTER_AWS_S3); diff --git a/app/Actions/Backups/GenerateBackupDownloadLink.php b/app/Actions/Backups/GenerateBackupDownloadLink.php index 6f0e90512..e159937cf 100644 --- a/app/Actions/Backups/GenerateBackupDownloadLink.php +++ b/app/Actions/Backups/GenerateBackupDownloadLink.php @@ -19,10 +19,6 @@ final readonly class GenerateBackupDownloadLink implements GeneratesBackupDownlo { public function __construct(private BackupManager $backupManager, private NodeJWTService $jwtService) {} - /** - * Returns the URL that allows for a backup to be downloaded by an individual - * user, or by the Wings control software. - */ public function generate(Backup $backup, User $user): string { throw_if($backup->disk !== Backup::ADAPTER_AWS_S3 && $backup->disk !== Backup::ADAPTER_WINGS, BadRequestHttpException::class, 'The backup requested references an unknown disk driver type and cannot be downloaded.'); @@ -44,10 +40,6 @@ final readonly class GenerateBackupDownloadLink implements GeneratesBackupDownlo return sprintf('%s/download/backup?token=%s', $backup->server->node->getConnectionAddress(), $token->toString()); } - /** - * Returns a signed URL that allows us to download a file directly out of a non-public - * S3 bucket by using a signed URL. - */ private function getS3BackupUrl(Backup $backup): string { $adapter = $this->backupManager->adapter(Backup::ADAPTER_AWS_S3); diff --git a/app/Actions/Backups/InitiateBackup.php b/app/Actions/Backups/InitiateBackup.php index 0cebb0343..66703a6f2 100644 --- a/app/Actions/Backups/InitiateBackup.php +++ b/app/Actions/Backups/InitiateBackup.php @@ -8,7 +8,6 @@ use Carbon\CarbonImmutable; use Illuminate\Database\Eloquent\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Validator; -use Illuminate\Validation\ValidationException; use Pterodactyl\Contracts\Backups\DeletesBackups; use Pterodactyl\Contracts\Backups\InitiatesBackups; use Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException; @@ -34,12 +33,7 @@ final class InitiateBackup implements InitiatesBackups private readonly BackupManager $backupManager, ) {} - /** - * A backup's fields: an optional name, whether it is locked against deletion, and the - * files and folders to leave out of it. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -50,10 +44,6 @@ final class InitiateBackup implements InitiatesBackups ]; } - /** - * Set if the backup should be locked once it is created which will prevent - * its deletion by users or automated system processes. - */ public function setIsLocked(bool $isLocked): InitiatesBackups { $this->isLocked = $isLocked; @@ -61,12 +51,6 @@ final class InitiateBackup implements InitiatesBackups return $this; } - /** - * Sets the files to be ignored by this backup. They are validated when the backup is - * initiated. - * - * @param list|null $ignored - */ public function setIgnoredFiles(?array $ignored): InitiatesBackups { $this->ignoredFiles = $ignored ?? []; @@ -74,19 +58,6 @@ final class InitiateBackup implements InitiatesBackups return $this; } - /** - * Initiates the backup process for a server on Wings. - * - * The rows are written in a transaction, but Wings is only asked to start the backup - * once that transaction commits, and backups rotated out to make room are deleted only - * after Wings accepted the new one. A rejected backup is marked failed and nothing is - * rotated out, so the oldest backup survives a failed attempt. - * - * @throws Throwable - * @throws TooManyBackupsException - * @throws TooManyRequestsHttpException - * @throws ValidationException - */ public function initiate(Server $server, ?string $name = null, bool $override = false): Backup { Validator::validate(['name' => $name, 'is_locked' => $this->isLocked, 'ignored_files' => $this->ignoredFiles], self::rules()); @@ -151,6 +122,8 @@ final class InitiateBackup implements InitiatesBackups return [$backup, $rotated]; }); + // Wings is only asked once the rows are committed, and backups rotated out to make room + // are deleted only after it accepts the new one. try { Daemon::server($server)->backups()->create($backup); } catch (Throwable $throwable) { diff --git a/app/Actions/Backups/PresignBackupUpload.php b/app/Actions/Backups/PresignBackupUpload.php index ba71d87e3..1c7b9c92d 100644 --- a/app/Actions/Backups/PresignBackupUpload.php +++ b/app/Actions/Backups/PresignBackupUpload.php @@ -17,14 +17,6 @@ final readonly class PresignBackupUpload implements PresignsBackupUploads public function __construct(private BackupManager $backupManager) {} - /** - * Opens a multipart upload for the backup in S3 and returns one presigned URL per part - * Wings needs to upload for an archive of the given size. - * - * @return BackupUploadParts - * - * @throws BadRequestHttpException - */ public function presign(Backup $backup, int $size): array { $adapter = $this->backupManager->adapter(); diff --git a/app/Actions/Backups/RestoreBackup.php b/app/Actions/Backups/RestoreBackup.php index d0e302a0a..5661f3052 100644 --- a/app/Actions/Backups/RestoreBackup.php +++ b/app/Actions/Backups/RestoreBackup.php @@ -13,7 +13,6 @@ use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; use Pterodactyl\Models\User; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Throwable; final readonly class RestoreBackup implements RestoresBackups { @@ -22,8 +21,7 @@ final readonly class RestoreBackup implements RestoresBackups ) {} /** - * A restore's fields: whether the server's files are deleted before the backup is - * unpacked over them. The action takes the flag as a bool, which always meets them. + * The action takes `truncate` as a bool, which always meets these rules. * * @return NormalizedValidationRules */ @@ -34,12 +32,6 @@ final readonly class RestoreBackup implements RestoresBackups ]; } - /** - * Marks the server as restoring and asks Wings to unpack the backup over its files. - * S3 backups are handed to Wings as a signed download link. - * - * @throws Throwable - */ public function restore(Server $server, Backup $backup, User $user, bool $truncate): void { throw_if(($server->status) !== null, BadRequestHttpException::class, 'This server is not currently in a state that allows for a backup to be restored.'); diff --git a/app/Actions/Databases/CreateDatabase.php b/app/Actions/Databases/CreateDatabase.php index 40b07cf8b..ff92b84a9 100644 --- a/app/Actions/Databases/CreateDatabase.php +++ b/app/Actions/Databases/CreateDatabase.php @@ -41,7 +41,7 @@ final class CreateDatabase implements CreatesDatabases ) {} /** - * A database's fields. The name is the full one, already prefixed with "s{server_id}_" by + * The name is the full one, already prefixed with "s{server_id}_" by * DatabaseName::generateUnique(). * * @return NormalizedValidationRules @@ -63,13 +63,6 @@ final class CreateDatabase implements CreatesDatabases return $this; } - /** - * @param array $input - * - * @throws Throwable - * @throws TooManyDatabasesException - * @throws DatabaseClientFeatureNotEnabledException - */ public function create(Server $server, array $input): Database { throw_unless(config('pterodactyl.client_features.databases.enabled'), DatabaseClientFeatureNotEnabledException::class); diff --git a/app/Actions/Databases/CreateDatabaseHost.php b/app/Actions/Databases/CreateDatabaseHost.php index bc911f9dc..1a9d7ee09 100644 --- a/app/Actions/Databases/CreateDatabaseHost.php +++ b/app/Actions/Databases/CreateDatabaseHost.php @@ -12,18 +12,12 @@ use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class CreateDatabaseHost implements CreatesDatabaseHosts { public function __construct(private DynamicDatabaseConnection $dynamic, private ExtensionFields $extensions) {} - /** - * A database host's fields, for creating one and for updating one. The host is a hostname - * or IP address, and the node, when given, must exist. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -36,13 +30,6 @@ final readonly class CreateDatabaseHost implements CreatesDatabaseHosts ]; } - /** - * Create a new database host on the Panel once it accepts the given credentials. - * - * @param array $input - * - * @throws Throwable - */ public function create(array $input): DatabaseHost { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Databases/DeleteDatabase.php b/app/Actions/Databases/DeleteDatabase.php index dddd708f7..4f8945dd7 100644 --- a/app/Actions/Databases/DeleteDatabase.php +++ b/app/Actions/Databases/DeleteDatabase.php @@ -4,7 +4,6 @@ declare(strict_types=1); namespace Pterodactyl\Actions\Databases; -use Exception; use Pterodactyl\Contracts\Databases\DeletesDatabases; use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Facades\Activity; @@ -18,7 +17,6 @@ final readonly class DeleteDatabase implements DeletesDatabases private DatabaseHostGateway $gateway, ) {} - /** @throws Exception */ public function delete(Database $database): ?bool { $this->dynamic->set('dynamic', $database->relationLoaded('host') ? $database->host : $database->database_host_id); diff --git a/app/Actions/Databases/DeleteDatabaseHost.php b/app/Actions/Databases/DeleteDatabaseHost.php index 2d3b0a087..11a8ddb91 100644 --- a/app/Actions/Databases/DeleteDatabaseHost.php +++ b/app/Actions/Databases/DeleteDatabaseHost.php @@ -10,11 +10,6 @@ use Pterodactyl\Models\DatabaseHost; final readonly class DeleteDatabaseHost implements DeletesDatabaseHosts { - /** - * Delete a database host, provided no databases are attached to it. - * - * @throws HasActiveServersException - */ public function delete(DatabaseHost $host): void { if ($host->databases()->exists()) { diff --git a/app/Actions/Databases/DeployServerDatabase.php b/app/Actions/Databases/DeployServerDatabase.php index f9da2530d..67ee511f0 100644 --- a/app/Actions/Databases/DeployServerDatabase.php +++ b/app/Actions/Databases/DeployServerDatabase.php @@ -9,22 +9,18 @@ use Illuminate\Support\Facades\Validator; use Pterodactyl\Contracts\Databases\CreatesDatabases; use Pterodactyl\Contracts\Databases\DeploysServerDatabases; use Pterodactyl\Exceptions\DisplayException; -use Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException; use Pterodactyl\Exceptions\Service\Database\NoSuitableDatabaseHostException; -use Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException; use Pterodactyl\Models\Database; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Models\Server; use Pterodactyl\Support\DatabaseName; -use Throwable; final readonly class DeployServerDatabase implements DeploysServerDatabases { public function __construct(private CreatesDatabases $createDatabase) {} /** - * The fields of a database to deploy. The name is the one a user picks, before the - * "s{server_id}_" prefix is added; with no host given, one is picked for the server. + * The name is the one a user picks, before the "s{server_id}_" prefix is added. * * @return NormalizedValidationRules */ @@ -40,15 +36,6 @@ final readonly class DeployServerDatabase implements DeploysServerDatabases ]; } - /** - * @param array $input - * - * @throws Throwable - * @throws TooManyDatabasesException - * @throws DatabaseClientFeatureNotEnabledException - * @throws NoSuitableDatabaseHostException - * @throws DisplayException - */ public function deploy(Server $server, array $input): Database { $validated = Validator::make($input, self::rules())->safe(); diff --git a/app/Actions/Databases/RotateDatabasePassword.php b/app/Actions/Databases/RotateDatabasePassword.php index 61b43a69f..42fb2b95c 100644 --- a/app/Actions/Databases/RotateDatabasePassword.php +++ b/app/Actions/Databases/RotateDatabasePassword.php @@ -12,7 +12,6 @@ use Pterodactyl\Facades\Activity; use Pterodactyl\Helpers\Utilities; use Pterodactyl\Models\Database; use Pterodactyl\Services\Databases\DatabaseHostGateway; -use Throwable; final readonly class RotateDatabasePassword implements RotatesDatabasePasswords { @@ -21,7 +20,6 @@ final readonly class RotateDatabasePassword implements RotatesDatabasePasswords private DatabaseHostGateway $gateway, ) {} - /** @throws Throwable */ public function rotate(Database $database): string { $password = Utilities::randomStringWithSpecialCharacters(24); diff --git a/app/Actions/Databases/UpdateDatabaseHost.php b/app/Actions/Databases/UpdateDatabaseHost.php index 37d5240b0..b371c9309 100644 --- a/app/Actions/Databases/UpdateDatabaseHost.php +++ b/app/Actions/Databases/UpdateDatabaseHost.php @@ -13,19 +13,11 @@ use Pterodactyl\Extensions\DynamicDatabaseConnection; use Pterodactyl\Models\DatabaseHost; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class UpdateDatabaseHost implements UpdatesDatabaseHosts { public function __construct(private DynamicDatabaseConnection $dynamic, private ExtensionFields $extensions) {} - /** - * Update a database host and persist to the database. - * - * @param array $input - * - * @throws Throwable - */ public function update(DatabaseHost $host, array $input): DatabaseHost { $validated = Validator::validate($input, CreateDatabaseHost::rules()); diff --git a/app/Actions/Eggs/CreateEgg.php b/app/Actions/Eggs/CreateEgg.php index 70895ba0c..9886c0619 100644 --- a/app/Actions/Eggs/CreateEgg.php +++ b/app/Actions/Eggs/CreateEgg.php @@ -28,10 +28,8 @@ final readonly class CreateEgg implements CreatesEggs public function __construct(private ExtensionFields $extensions) {} /** - * An egg's fields, for creating one and for updating one. The Docker images are one per - * line, each held to DOCKER_IMAGE (see DockerImageList). An egg that copies its config from - * another needs none of its own; every config block given must be JSON, apart from the - * stop command. + * The Docker images are one per line, each held to DOCKER_IMAGE. An egg that copies its + * config from another needs none of its own. * * @return NormalizedValidationRules */ @@ -72,11 +70,6 @@ final readonly class CreateEgg implements CreatesEggs return $normalized; } - /** - * Create an egg, stamping the configured service author. - * - * @param array $input - */ public function create(array $input): Egg { // A parent egg of 0 is the legacy "no parent egg" sentinel. diff --git a/app/Actions/Eggs/DeleteEgg.php b/app/Actions/Eggs/DeleteEgg.php index c1f256c21..1b7bc73a3 100644 --- a/app/Actions/Eggs/DeleteEgg.php +++ b/app/Actions/Eggs/DeleteEgg.php @@ -12,13 +12,6 @@ use Pterodactyl\Models\Egg; final class DeleteEgg implements DeletesEggs { - /** - * Delete an egg, provided no servers use it and no eggs inherit their - * configuration from it. - * - * @throws HasActiveServersException - * @throws HasChildrenException - */ public function delete(Egg $egg): void { if ($egg->servers()->exists()) { diff --git a/app/Actions/Eggs/Scripts/UpdateInstallScript.php b/app/Actions/Eggs/Scripts/UpdateInstallScript.php index 3fe4c3e46..c8fa056ab 100644 --- a/app/Actions/Eggs/Scripts/UpdateInstallScript.php +++ b/app/Actions/Eggs/Scripts/UpdateInstallScript.php @@ -11,13 +11,7 @@ use Pterodactyl\Models\Egg; final class UpdateInstallScript implements UpdatesEggInstallScripts { - /** - * An egg's install script fields, each of them optional: the script, whether it runs - * privileged, the container entrypoint and image it runs in, and the egg to copy the - * script from instead. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -29,13 +23,6 @@ final class UpdateInstallScript implements UpdatesEggInstallScripts ]; } - /** - * Modify the install script for a given Egg. - * - * @param array $input - * - * @throws InvalidCopyFromException - */ public function update(Egg $egg, array $input): Egg { $attributes = Validator::validate($input, self::rules()); diff --git a/app/Actions/Eggs/Sharing/ExportEgg.php b/app/Actions/Eggs/Sharing/ExportEgg.php index ca46a9819..75e15fafc 100644 --- a/app/Actions/Eggs/Sharing/ExportEgg.php +++ b/app/Actions/Eggs/Sharing/ExportEgg.php @@ -5,17 +5,11 @@ declare(strict_types=1); namespace Pterodactyl\Actions\Eggs\Sharing; use Illuminate\Support\Collection; -use JsonException; use Pterodactyl\Contracts\Eggs\ExportsEggs; use Pterodactyl\Models\Egg; final class ExportEgg implements ExportsEggs { - /** - * Return a JSON representation of an egg and its variables. - * - * @throws JsonException - */ public function export(Egg $egg): string { $egg->loadMissing('scriptFrom', 'configFrom', 'variables'); diff --git a/app/Actions/Eggs/Sharing/ImportEgg.php b/app/Actions/Eggs/Sharing/ImportEgg.php index 3f49c8663..89f2d2617 100644 --- a/app/Actions/Eggs/Sharing/ImportEgg.php +++ b/app/Actions/Eggs/Sharing/ImportEgg.php @@ -7,19 +7,16 @@ namespace Pterodactyl\Actions\Eggs\Sharing; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\DB; use Pterodactyl\Contracts\Eggs\ImportsEggs; -use Pterodactyl\Exceptions\Service\InvalidFileUploadException; use Pterodactyl\Models\Egg; use Pterodactyl\Models\EggVariable; use Pterodactyl\Services\Eggs\EggImportData; use Pterodactyl\Services\Eggs\EggParserService; use Ramsey\Uuid\Uuid; -use Throwable; final readonly class ImportEgg implements ImportsEggs { public function __construct(private EggParserService $parser) {} - /** @throws InvalidFileUploadException|Throwable */ public function import(UploadedFile $file): Egg { return $this->importParsed($this->parser->handle($file)); diff --git a/app/Actions/Eggs/Sharing/UpdateEggFromImport.php b/app/Actions/Eggs/Sharing/UpdateEggFromImport.php index 06e8aa890..0494f0038 100644 --- a/app/Actions/Eggs/Sharing/UpdateEggFromImport.php +++ b/app/Actions/Eggs/Sharing/UpdateEggFromImport.php @@ -7,18 +7,15 @@ namespace Pterodactyl\Actions\Eggs\Sharing; use Illuminate\Http\UploadedFile; use Illuminate\Support\Facades\DB; use Pterodactyl\Contracts\Eggs\UpdatesEggsFromImports; -use Pterodactyl\Exceptions\Service\InvalidFileUploadException; use Pterodactyl\Models\Egg; use Pterodactyl\Models\EggVariable; use Pterodactyl\Services\Eggs\EggImportVariable; use Pterodactyl\Services\Eggs\EggParserService; -use Throwable; final readonly class UpdateEggFromImport implements UpdatesEggsFromImports { public function __construct(private EggParserService $parser) {} - /** @throws InvalidFileUploadException|Throwable */ public function update(Egg $egg, UploadedFile $file): Egg { $parsed = $this->parser->handle($file); diff --git a/app/Actions/Eggs/UpdateEgg.php b/app/Actions/Eggs/UpdateEgg.php index 3eb490150..6daf4a495 100644 --- a/app/Actions/Eggs/UpdateEgg.php +++ b/app/Actions/Eggs/UpdateEgg.php @@ -16,11 +16,6 @@ final readonly class UpdateEgg implements UpdatesEggs { public function __construct(private ExtensionFields $extensions) {} - /** - * Update an egg with the fields it is created with. - * - * @param array $input - */ public function update(Egg $egg, array $input): Egg { // A parent egg of 0 is the legacy "no parent egg" sentinel. diff --git a/app/Actions/Eggs/Variables/CreateEggVariable.php b/app/Actions/Eggs/Variables/CreateEggVariable.php index 5a968d47b..c4c6ce8fd 100644 --- a/app/Actions/Eggs/Variables/CreateEggVariable.php +++ b/app/Actions/Eggs/Variables/CreateEggVariable.php @@ -16,10 +16,8 @@ use Pterodactyl\Rules\ValidRuleSet; final class CreateEggVariable implements CreatesEggVariables { /** - * An egg variable's fields, whether it is written through the admin API or arrives in an - * imported egg, and the options that set whether users can see and edit it. Pass the egg - * to hold the environment variable name unique among its variables, and the variable - * being updated so its own name is not taken for a duplicate. + * Pass the egg to hold the environment variable name unique among its variables, and the + * variable being updated so its own name is not taken for a duplicate. * * @return NormalizedValidationRules */ @@ -41,11 +39,6 @@ final class CreateEggVariable implements CreatesEggVariables ]; } - /** - * Create a new variable for a given Egg. - * - * @param array $input - */ public function create(Egg $egg, array $input): EggVariable { $validated = Validator::validate($input, self::rules($egg)); diff --git a/app/Actions/Eggs/Variables/DeleteEggVariable.php b/app/Actions/Eggs/Variables/DeleteEggVariable.php index 4299b3783..2ebe9453d 100644 --- a/app/Actions/Eggs/Variables/DeleteEggVariable.php +++ b/app/Actions/Eggs/Variables/DeleteEggVariable.php @@ -9,9 +9,6 @@ use Pterodactyl\Models\EggVariable; final readonly class DeleteEggVariable implements DeletesEggVariables { - /** - * Delete an egg variable. - */ public function delete(EggVariable $variable): void { $variable->delete(); diff --git a/app/Actions/Eggs/Variables/ReorderEggVariables.php b/app/Actions/Eggs/Variables/ReorderEggVariables.php index 6944d59ee..3cf94cbe2 100644 --- a/app/Actions/Eggs/Variables/ReorderEggVariables.php +++ b/app/Actions/Eggs/Variables/ReorderEggVariables.php @@ -12,12 +12,7 @@ use Pterodactyl\Models\Egg; final readonly class ReorderEggVariables implements ReordersEggVariables { - /** - * The variable ids of an egg in their new order, each once. An id may be an integer or - * a numeric string. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -27,8 +22,6 @@ final readonly class ReorderEggVariables implements ReordersEggVariables } /** - * Validates variable ids under `order` and returns them as integers. - * * @param list $order * @return list */ @@ -39,7 +32,6 @@ final readonly class ReorderEggVariables implements ReordersEggVariables return array_map(fn (int|string $key): int => $input->integer('order.'.$key), array_keys($input->array('order'))); } - /** @param list $order */ public function reorder(Egg $egg, array $order): void { $order = self::order($order); diff --git a/app/Actions/Eggs/Variables/UpdateEggVariable.php b/app/Actions/Eggs/Variables/UpdateEggVariable.php index d0da877f5..ac84dc177 100644 --- a/app/Actions/Eggs/Variables/UpdateEggVariable.php +++ b/app/Actions/Eggs/Variables/UpdateEggVariable.php @@ -12,11 +12,6 @@ use Pterodactyl\Models\EggVariable; final class UpdateEggVariable implements UpdatesEggVariables { - /** - * Update an egg variable with the fields it is created with. - * - * @param array $input - */ public function update(EggVariable $variable, array $input): EggVariable { $egg = Egg::query()->findOrFail($variable->egg_id); diff --git a/app/Actions/Extensions/ReplaceExtensionSettingFile.php b/app/Actions/Extensions/ReplaceExtensionSettingFile.php index cb2523ad8..aa9cf9cef 100644 --- a/app/Actions/Extensions/ReplaceExtensionSettingFile.php +++ b/app/Actions/Extensions/ReplaceExtensionSettingFile.php @@ -16,9 +16,6 @@ final readonly class ReplaceExtensionSettingFile implements ReplacesExtensionSet { public function __construct(private ExtensionSettingFiles $files) {} - /** - * @return list - */ public function replace(ExtensionSettingsDefinition $definition, string $input, ?UploadedFile $upload): array { $field = $definition->fileField($input); diff --git a/app/Actions/Extensions/UpdateExtensionSettings.php b/app/Actions/Extensions/UpdateExtensionSettings.php index 1042a1a90..d635a432f 100644 --- a/app/Actions/Extensions/UpdateExtensionSettings.php +++ b/app/Actions/Extensions/UpdateExtensionSettings.php @@ -9,10 +9,6 @@ use Pterodactyl\Services\Extensions\ExtensionSettingsDefinition; final readonly class UpdateExtensionSettings implements UpdatesExtensionSettings { - /** - * @param array $settings - * @return list - */ public function update(ExtensionSettingsDefinition $definition, array $settings): array { $definition->update($settings); diff --git a/app/Actions/Files/ChangeFilePermissions.php b/app/Actions/Files/ChangeFilePermissions.php index 8b95080bd..93cd9a257 100644 --- a/app/Actions/Files/ChangeFilePermissions.php +++ b/app/Actions/Files/ChangeFilePermissions.php @@ -11,7 +11,6 @@ use Pterodactyl\Models\Server; final readonly class ChangeFilePermissions implements ChangesFilePermissions { - /** @param array $files */ public function change(Server $server, ?string $root, array $files): void { Daemon::server($server)->files()->chmodFiles($root, $files); diff --git a/app/Actions/Files/CompressFiles.php b/app/Actions/Files/CompressFiles.php index 20055d95c..6eab5ba03 100644 --- a/app/Actions/Files/CompressFiles.php +++ b/app/Actions/Files/CompressFiles.php @@ -11,10 +11,6 @@ use Pterodactyl\Models\Server; final readonly class CompressFiles implements CompressesFiles { - /** - * @param array $files - * @return DaemonFileObject - */ public function compress(Server $server, ?string $root, array $files): array { $archive = Daemon::server($server)->files()->compressFiles($root, $files); diff --git a/app/Actions/Files/DeleteFiles.php b/app/Actions/Files/DeleteFiles.php index b13ff1011..8ae0756c1 100644 --- a/app/Actions/Files/DeleteFiles.php +++ b/app/Actions/Files/DeleteFiles.php @@ -11,7 +11,6 @@ use Pterodactyl\Models\Server; final readonly class DeleteFiles implements DeletesFiles { - /** @param array $files */ public function delete(Server $server, ?string $root, array $files): void { Daemon::server($server)->files()->deleteFiles($root, $files); diff --git a/app/Actions/Files/PullFile.php b/app/Actions/Files/PullFile.php index 5f13e0595..e32231545 100644 --- a/app/Actions/Files/PullFile.php +++ b/app/Actions/Files/PullFile.php @@ -11,7 +11,6 @@ use Pterodactyl\Models\Server; final readonly class PullFile implements PullsFiles { - /** @param array{filename?: string|null, use_header?: bool, foreground?: bool, timeout?: int} $options */ public function pull(Server $server, string $url, ?string $directory, array $options): void { Daemon::server($server)->files()->pull($url, $directory, $options); diff --git a/app/Actions/Files/RenameFiles.php b/app/Actions/Files/RenameFiles.php index 2bd3eed0e..629b2c856 100644 --- a/app/Actions/Files/RenameFiles.php +++ b/app/Actions/Files/RenameFiles.php @@ -11,7 +11,6 @@ use Pterodactyl\Models\Server; final readonly class RenameFiles implements RenamesFiles { - /** @param array $files */ public function rename(Server $server, ?string $root, array $files): void { Daemon::server($server)->files()->renameFiles($root, $files); diff --git a/app/Actions/Locations/CreateLocation.php b/app/Actions/Locations/CreateLocation.php index c26e5f2cd..2d0e6bf41 100644 --- a/app/Actions/Locations/CreateLocation.php +++ b/app/Actions/Locations/CreateLocation.php @@ -17,8 +17,7 @@ final readonly class CreateLocation implements CreatesLocations public function __construct(private ExtensionFields $extensions) {} /** - * A location's fields. Pass the location being updated so its own short code is not - * taken for a duplicate. + * Pass the location being updated so its own short code is not taken for a duplicate. * * @return NormalizedValidationRules */ @@ -30,9 +29,6 @@ final readonly class CreateLocation implements CreatesLocations ]; } - /** - * @param array $input - */ public function create(array $input): Location { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Locations/DeleteLocation.php b/app/Actions/Locations/DeleteLocation.php index 6f7d1eea6..bbb63fa35 100644 --- a/app/Actions/Locations/DeleteLocation.php +++ b/app/Actions/Locations/DeleteLocation.php @@ -10,11 +10,6 @@ use Pterodactyl\Models\Location; final class DeleteLocation implements DeletesLocations { - /** - * Delete a location, provided no nodes are assigned to it. - * - * @throws HasActiveNodesException - */ public function delete(Location $location): void { if ($location->nodes()->exists()) { diff --git a/app/Actions/Locations/UpdateLocation.php b/app/Actions/Locations/UpdateLocation.php index 5e20b176b..b3322989e 100644 --- a/app/Actions/Locations/UpdateLocation.php +++ b/app/Actions/Locations/UpdateLocation.php @@ -15,9 +15,6 @@ final readonly class UpdateLocation implements UpdatesLocations { public function __construct(private ExtensionFields $extensions) {} - /** - * @param array $input - */ public function update(Location $location, array $input): Location { $validated = Validator::validate($input, CreateLocation::rules($location)); diff --git a/app/Actions/Mounts/AttachEggsToMount.php b/app/Actions/Mounts/AttachEggsToMount.php index 4c132329e..a918bbf3b 100644 --- a/app/Actions/Mounts/AttachEggsToMount.php +++ b/app/Actions/Mounts/AttachEggsToMount.php @@ -15,11 +15,7 @@ final readonly class AttachEggsToMount implements AttachesEggsToMounts { use ValidatesArrayExistence; - /** - * The eggs to attach: a list of egg ids, each an integer or a numeric string. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -28,20 +24,14 @@ final readonly class AttachEggsToMount implements AttachesEggsToMounts ]; } - /** - * Attach eggs to a mount, keeping any eggs already attached. - * - * @param list $eggIds - */ public function attach(Mount $mount, array $eggIds): void { $mount->eggs()->syncWithoutDetaching($this->eggIds($eggIds)); } /** - * Validates the egg ids under `eggs` and returns them as integers. Each id must name an - * egg; they are all looked up in one query, and a missing one fails `eggs.N` as an exists - * rule would. + * The eggs are looked up in one query, and a missing one fails `eggs.N` as an exists rule + * would. * * @param list $eggIds * @return list diff --git a/app/Actions/Mounts/AttachNodesToMount.php b/app/Actions/Mounts/AttachNodesToMount.php index 96ec46c97..7e96e0ece 100644 --- a/app/Actions/Mounts/AttachNodesToMount.php +++ b/app/Actions/Mounts/AttachNodesToMount.php @@ -15,11 +15,7 @@ final readonly class AttachNodesToMount implements AttachesNodesToMounts { use ValidatesArrayExistence; - /** - * The nodes to attach: a list of node ids, each an integer or a numeric string. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -28,20 +24,14 @@ final readonly class AttachNodesToMount implements AttachesNodesToMounts ]; } - /** - * Attach nodes to a mount, keeping any nodes already attached. - * - * @param list $nodeIds - */ public function attach(Mount $mount, array $nodeIds): void { $mount->nodes()->syncWithoutDetaching($this->nodeIds($nodeIds)); } /** - * Validates the node ids under `nodes` and returns them as integers. Each id must name a - * node; they are all looked up in one query, and a missing one fails `nodes.N` as an - * exists rule would. + * The nodes are looked up in one query, and a missing one fails `nodes.N` as an exists rule + * would. * * @param list $nodeIds * @return list diff --git a/app/Actions/Mounts/CreateMount.php b/app/Actions/Mounts/CreateMount.php index b553ad713..a67976128 100644 --- a/app/Actions/Mounts/CreateMount.php +++ b/app/Actions/Mounts/CreateMount.php @@ -19,10 +19,10 @@ final readonly class CreateMount implements CreatesMounts public function __construct(private ExtensionFields $extensions) {} /** - * A mount's fields. Pass the mount being updated so its own name is not taken for a - * duplicate. Both paths are absolute. Once '.' and '..' are resolved, the source may not - * be the Wings configuration directory or anything in it, nor a whole volumes directory, - * and the target may not be the container's home directory itself. + * Pass the mount being updated so its own name is not taken for a duplicate. Once '.' and + * '..' are resolved, the source may not be the Wings configuration directory or anything in + * it, nor a whole volumes directory, and the target may not be the container's home + * directory itself. * * @return NormalizedValidationRules */ @@ -58,11 +58,6 @@ final readonly class CreateMount implements CreatesMounts ]; } - /** - * Create a new mount, assigning it a fresh UUID. - * - * @param array $input - */ public function create(array $input): Mount { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Mounts/DeleteMount.php b/app/Actions/Mounts/DeleteMount.php index 7685b9e65..2e1c2c54c 100644 --- a/app/Actions/Mounts/DeleteMount.php +++ b/app/Actions/Mounts/DeleteMount.php @@ -9,9 +9,6 @@ use Pterodactyl\Models\Mount; final readonly class DeleteMount implements DeletesMounts { - /** - * Delete a mount. - */ public function delete(Mount $mount): void { $mount->delete(); diff --git a/app/Actions/Mounts/DetachEggFromMount.php b/app/Actions/Mounts/DetachEggFromMount.php index d4239bafb..99fdc03f5 100644 --- a/app/Actions/Mounts/DetachEggFromMount.php +++ b/app/Actions/Mounts/DetachEggFromMount.php @@ -10,9 +10,6 @@ use Pterodactyl\Models\Mount; final readonly class DetachEggFromMount implements DetachesEggsFromMounts { - /** - * Remove a single egg attachment from a mount. - */ public function detach(Mount $mount, Egg $egg): void { $mount->eggs()->detach($egg->id); diff --git a/app/Actions/Mounts/DetachNodeFromMount.php b/app/Actions/Mounts/DetachNodeFromMount.php index 0d8a161d1..6e0057c7e 100644 --- a/app/Actions/Mounts/DetachNodeFromMount.php +++ b/app/Actions/Mounts/DetachNodeFromMount.php @@ -10,9 +10,6 @@ use Pterodactyl\Models\Node; final readonly class DetachNodeFromMount implements DetachesNodesFromMounts { - /** - * Remove a single node attachment from a mount. - */ public function detach(Mount $mount, Node $node): void { $mount->nodes()->detach($node->id); diff --git a/app/Actions/Mounts/UpdateMount.php b/app/Actions/Mounts/UpdateMount.php index a0eadd8c2..bcd8015c3 100644 --- a/app/Actions/Mounts/UpdateMount.php +++ b/app/Actions/Mounts/UpdateMount.php @@ -15,9 +15,6 @@ final readonly class UpdateMount implements UpdatesMounts { public function __construct(private ExtensionFields $extensions) {} - /** - * @param array $input - */ public function update(Mount $mount, array $input): Mount { $validated = Validator::validate($input, CreateMount::rules($mount)); diff --git a/app/Actions/Nodes/CreateNode.php b/app/Actions/Nodes/CreateNode.php index 01d398e49..11cecd6a0 100644 --- a/app/Actions/Nodes/CreateNode.php +++ b/app/Actions/Nodes/CreateNode.php @@ -19,8 +19,8 @@ final readonly class CreateNode implements CreatesNodes public function __construct(private ExtensionFields $extensions) {} /** - * A node's fields, for creating one and for updating one. The daemon fields go by their - * API names, which map onto the daemonListen, daemonSFTP and daemonBase columns. + * The daemon fields go by their API names, which map onto the daemonListen, daemonSFTP and + * daemonBase columns. * * @return NormalizedValidationRules */ @@ -46,11 +46,6 @@ final readonly class CreateNode implements CreatesNodes ]; } - /** - * Create a node and mint its daemon token pair. - * - * @param array $input - */ public function create(array $input): Node { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Nodes/DeleteNode.php b/app/Actions/Nodes/DeleteNode.php index a13fc1659..44761df7c 100644 --- a/app/Actions/Nodes/DeleteNode.php +++ b/app/Actions/Nodes/DeleteNode.php @@ -11,11 +11,6 @@ use Pterodactyl\Models\Node; final class DeleteNode implements DeletesNodes { - /** - * Delete a node from the panel if no servers are attached to it. - * - * @throws HasActiveServersException - */ public function delete(Node $node): void { if ($node->servers()->exists()) { diff --git a/app/Actions/Nodes/ResetServerStates.php b/app/Actions/Nodes/ResetServerStates.php index c32b19ec5..ed131dc39 100644 --- a/app/Actions/Nodes/ResetServerStates.php +++ b/app/Actions/Nodes/ResetServerStates.php @@ -11,16 +11,9 @@ use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Node; use Pterodactyl\Models\Server; -use Throwable; final readonly class ResetServerStates implements ResetsServerStates { - /** - * Returns every installing or restoring server on the node to a normal state after a - * Wings restart, logging a failed restore for each backup that was in progress. - * - * @throws Throwable - */ public function reset(Node $node): void { $servers = Server::query() diff --git a/app/Actions/Nodes/UpdateNode.php b/app/Actions/Nodes/UpdateNode.php index d7ec28ff0..f63bd76dd 100644 --- a/app/Actions/Nodes/UpdateNode.php +++ b/app/Actions/Nodes/UpdateNode.php @@ -17,19 +17,11 @@ use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Node; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class UpdateNode implements UpdatesNodes { public function __construct(private ExtensionFields $extensions) {} - /** - * Update the configuration values for a given node on the machine. - * - * @param array $input - * - * @throws Throwable - */ public function update(Node $node, array $input, bool $resetToken = false): Node { $validated = Validator::validate($input, CreateNode::rules()); diff --git a/app/Actions/Schedules/CreateSchedule.php b/app/Actions/Schedules/CreateSchedule.php index 52be474fc..d2e93bd69 100644 --- a/app/Actions/Schedules/CreateSchedule.php +++ b/app/Actions/Schedules/CreateSchedule.php @@ -14,11 +14,7 @@ use Throwable; final class CreateSchedule implements CreatesSchedules { - /** - * A schedule's fields, for creating one and for updating one. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -33,11 +29,6 @@ final class CreateSchedule implements CreatesSchedules ]; } - /** - * @param array $input - * - * @throws DisplayException - */ public function create(Server $server, array $input): Schedule { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Schedules/CreateScheduleTask.php b/app/Actions/Schedules/CreateScheduleTask.php index 882777fb1..b63892131 100644 --- a/app/Actions/Schedules/CreateScheduleTask.php +++ b/app/Actions/Schedules/CreateScheduleTask.php @@ -13,13 +13,11 @@ use Pterodactyl\Exceptions\Service\ServiceLimitExceededException; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Task; -use Throwable; final readonly class CreateScheduleTask implements CreatesScheduleTasks { /** - * A task's fields, for creating one and for updating one. A power task's payload - * must name the power action to send. + * A power task's payload must name the power action to send. * * @return NormalizedValidationRules */ @@ -39,16 +37,6 @@ final readonly class CreateScheduleTask implements CreatesScheduleTasks ]; } - /** - * Appends a task to the schedule, or slots it into the requested position by - * shifting the tasks that follow it. - * - * @param array $input - * - * @throws HttpForbiddenException - * @throws ServiceLimitExceededException - * @throws Throwable - */ public function create(Schedule $schedule, array $input): Task { $validated = Validator::make($input, self::rules(($input['action'] ?? null) === Task::ACTION_POWER))->safe(); diff --git a/app/Actions/Schedules/DeleteScheduleTask.php b/app/Actions/Schedules/DeleteScheduleTask.php index 2241ba211..50b21b349 100644 --- a/app/Actions/Schedules/DeleteScheduleTask.php +++ b/app/Actions/Schedules/DeleteScheduleTask.php @@ -9,15 +9,9 @@ use Pterodactyl\Contracts\Schedules\DeletesScheduleTasks; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Task; -use Throwable; final readonly class DeleteScheduleTask implements DeletesScheduleTasks { - /** - * Deletes the task and closes the gap it leaves in the schedule's sequence. - * - * @throws Throwable - */ public function delete(Schedule $schedule, Task $task): void { DB::transaction(function () use ($schedule, $task): void { diff --git a/app/Actions/Schedules/ProcessSchedule.php b/app/Actions/Schedules/ProcessSchedule.php index 8dd5ee6e4..53df4c86b 100644 --- a/app/Actions/Schedules/ProcessSchedule.php +++ b/app/Actions/Schedules/ProcessSchedule.php @@ -18,11 +18,6 @@ use Throwable; final readonly class ProcessSchedule implements ProcessesSchedules { - /** - * Process a schedule and push the first task onto the queue worker. - * - * @throws Throwable - */ public function process(Schedule $schedule, bool $now = false): void { $this->run($schedule, $now); diff --git a/app/Actions/Schedules/UpdateSchedule.php b/app/Actions/Schedules/UpdateSchedule.php index 9dbc971dc..5f31ef4e3 100644 --- a/app/Actions/Schedules/UpdateSchedule.php +++ b/app/Actions/Schedules/UpdateSchedule.php @@ -13,11 +13,6 @@ use Throwable; final class UpdateSchedule implements UpdatesSchedules { - /** - * @param array $input - * - * @throws DisplayException - */ public function update(Schedule $schedule, array $input): Schedule { $validated = Validator::validate($input, CreateSchedule::rules()); diff --git a/app/Actions/Schedules/UpdateScheduleTask.php b/app/Actions/Schedules/UpdateScheduleTask.php index 1ea80f555..87c212472 100644 --- a/app/Actions/Schedules/UpdateScheduleTask.php +++ b/app/Actions/Schedules/UpdateScheduleTask.php @@ -11,19 +11,9 @@ use Pterodactyl\Exceptions\Http\HttpForbiddenException; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Task; -use Throwable; final readonly class UpdateScheduleTask implements UpdatesScheduleTasks { - /** - * Updates the task and, when its position changes, shifts the tasks between the - * old and new positions to keep the sequence contiguous. - * - * @param array $input - * - * @throws HttpForbiddenException - * @throws Throwable - */ public function update(Schedule $schedule, Task $task, array $input): Task { $validated = Validator::make($input, CreateScheduleTask::rules(($input['action'] ?? null) === Task::ACTION_POWER))->safe(); diff --git a/app/Actions/Servers/ChangeServerEgg.php b/app/Actions/Servers/ChangeServerEgg.php index 4dcb2acfc..00ff3b5e7 100644 --- a/app/Actions/Servers/ChangeServerEgg.php +++ b/app/Actions/Servers/ChangeServerEgg.php @@ -12,13 +12,9 @@ use Pterodactyl\Contracts\Servers\ChangesServerEgg; use Pterodactyl\Models\Egg; use Pterodactyl\Models\Server; use Pterodactyl\Models\ServerVariable; -use Throwable; final readonly class ChangeServerEgg implements ChangesServerEgg { - /** - * @throws Throwable - */ public function change(Server $server, Egg $egg, bool $keepVariables = false): Server { return DB::transaction(function () use ($server, $egg, $keepVariables): Server { diff --git a/app/Actions/Servers/CreateServer.php b/app/Actions/Servers/CreateServer.php index 4fb31d951..e068a1be9 100644 --- a/app/Actions/Servers/CreateServer.php +++ b/app/Actions/Servers/CreateServer.php @@ -10,16 +10,12 @@ use Illuminate\Support\Facades\Event; use Illuminate\Support\Facades\Validator; use Illuminate\Support\ValidatedInput; use Illuminate\Validation\Rule; -use Illuminate\Validation\ValidationException; use Pterodactyl\Actions\Allocations\CreateAllocations; use Pterodactyl\Contracts\Servers\CreatesServers; use Pterodactyl\Contracts\Servers\DeletesServers; use Pterodactyl\Data\ValidatedEggVariable; use Pterodactyl\Events\Server\OperationCompleted; -use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; -use Pterodactyl\Exceptions\Service\Deployment\NoViableAllocationException; -use Pterodactyl\Exceptions\Service\Deployment\NoViableNodeException; use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Egg; @@ -33,7 +29,6 @@ use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; use Pterodactyl\Services\Servers\VariableValidatorService; use Ramsey\Uuid\Uuid; -use Throwable; use UnexpectedValueException; final readonly class CreateServer implements CreatesServers @@ -47,11 +42,9 @@ final readonly class CreateServer implements CreatesServers ) {} /** - * A new server's fields. The default allocation and any additional ones must exist and - * belong to no server. Memory, disk, CPU and the feature limits take 0 for unlimited, - * and swap takes -1. The CPU threads are a pattern of cores such as "0-1,3", which a - * bare number also matches. Pass a server being updated so its own external id is not - * taken for a duplicate. + * Memory, disk, CPU and the feature limits take 0 for unlimited, and swap takes -1. The CPU + * threads are a pattern of cores such as "0-1,3", which a bare number also matches. Pass a + * server being updated so its own external id is not taken for a duplicate. * * @return NormalizedValidationRules */ @@ -84,15 +77,6 @@ final readonly class CreateServer implements CreatesServers ]; } - /** - * @param array $input - * - * @throws Throwable - * @throws DisplayException - * @throws ValidationException - * @throws NoViableNodeException - * @throws NoViableAllocationException - */ public function create(array $input, ?DeploymentObject $deployment = null): Server { $rules = self::rules(); diff --git a/app/Actions/Servers/DeleteServer.php b/app/Actions/Servers/DeleteServer.php index cc13a3f16..9aca86a08 100644 --- a/app/Actions/Servers/DeleteServer.php +++ b/app/Actions/Servers/DeleteServer.php @@ -12,7 +12,6 @@ use Illuminate\Support\Facades\Log; use Pterodactyl\Contracts\Databases\DeletesDatabases; use Pterodactyl\Contracts\Servers\DeletesServers; use Pterodactyl\Events\Server\OperationCompleted; -use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\Http\Connection\DaemonConnectionException; use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Server; @@ -33,10 +32,6 @@ final class DeleteServer implements DeletesServers return $this; } - /** - * @throws Throwable - * @throws DisplayException - */ public function delete(Server $server): void { try { diff --git a/app/Actions/Servers/RecordServerInstallResult.php b/app/Actions/Servers/RecordServerInstallResult.php index a31db25c8..87a97fecc 100644 --- a/app/Actions/Servers/RecordServerInstallResult.php +++ b/app/Actions/Servers/RecordServerInstallResult.php @@ -18,9 +18,7 @@ final readonly class RecordServerInstallResult implements RecordsServerInstallRe public function __construct(private ServerInstallService $serverInstallService) {} /** - * An install report's fields, as Wings sends them: whether the install script - * succeeded, and whether it ran as a reinstall. The action takes both as bools, which - * always meet them. + * The action takes both flags as bools, which always meet these rules. * * @return NormalizedValidationRules */ diff --git a/app/Actions/Servers/ReinstallServer.php b/app/Actions/Servers/ReinstallServer.php index e2975919c..b194e17fe 100644 --- a/app/Actions/Servers/ReinstallServer.php +++ b/app/Actions/Servers/ReinstallServer.php @@ -10,14 +10,9 @@ use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Facades\Activity; use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Server; -use Throwable; final readonly class ReinstallServer implements ReinstallsServers { - /** - * @throws DisplayException when the server skips its install script and is installed - * @throws Throwable - */ public function reinstall(Server $server): Server { throw_unless($server->canBeReinstalled(), DisplayException::class, trans('admin/server.exceptions.skipping_install_script')); diff --git a/app/Actions/Servers/ToggleServerInstallStatus.php b/app/Actions/Servers/ToggleServerInstallStatus.php index 4af52f941..e495050be 100644 --- a/app/Actions/Servers/ToggleServerInstallStatus.php +++ b/app/Actions/Servers/ToggleServerInstallStatus.php @@ -10,12 +10,6 @@ use Pterodactyl\Models\Server; final readonly class ToggleServerInstallStatus implements TogglesServerInstallStatus { - /** - * Flip a server between installed and installing. A server whose install - * failed must be reinstalled instead. - * - * @throws DisplayException - */ public function toggle(Server $server): void { if ($server->status === Server::STATUS_INSTALL_FAILED) { diff --git a/app/Actions/Servers/ToggleServerSuspension.php b/app/Actions/Servers/ToggleServerSuspension.php index 2eca508de..291635d5f 100644 --- a/app/Actions/Servers/ToggleServerSuspension.php +++ b/app/Actions/Servers/ToggleServerSuspension.php @@ -12,7 +12,6 @@ use Pterodactyl\Events\Server\OperationCompleted; use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Server; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; -use Throwable; final readonly class ToggleServerSuspension implements TogglesServerSuspension { @@ -20,7 +19,6 @@ final readonly class ToggleServerSuspension implements TogglesServerSuspension public const string ACTION_UNSUSPEND = TogglesServerSuspension::ACTION_UNSUSPEND; - /** @throws Throwable */ public function toggle(Server $server, string $action = self::ACTION_SUSPEND): void { throw_unless(in_array($action, [self::ACTION_SUSPEND, self::ACTION_UNSUSPEND], true), InvalidArgumentException::class, "Unsupported suspension action [$action]."); diff --git a/app/Actions/Servers/UpdateServerBuild.php b/app/Actions/Servers/UpdateServerBuild.php index 9ca267365..420fcf80c 100644 --- a/app/Actions/Servers/UpdateServerBuild.php +++ b/app/Actions/Servers/UpdateServerBuild.php @@ -15,7 +15,6 @@ use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Server; use Pterodactyl\Services\Servers\ServerConfigurationStructureService; -use Throwable; final readonly class UpdateServerBuild implements UpdatesServerBuild { @@ -24,10 +23,7 @@ final readonly class UpdateServerBuild implements UpdatesServerBuild ) {} /** - * A server's build fields. The default allocation must exist and be no other server's - * default; pass the server being updated so its own default is not taken for a clash. - * The limits take the values a new server takes, and the allocations to add or remove - * are lists of allocation ids. + * Pass the server being updated so its own default allocation is not taken for a clash. * * @return NormalizedValidationRules */ @@ -54,12 +50,6 @@ final readonly class UpdateServerBuild implements UpdatesServerBuild ]; } - /** - * @param array $input - * - * @throws Throwable - * @throws DisplayException - */ public function update(Server $server, array $input): Server { $rules = array_map(fn (array $rules): array => ['sometimes', ...$rules], self::rules($server)); diff --git a/app/Actions/Servers/UpdateServerDetails.php b/app/Actions/Servers/UpdateServerDetails.php index 6db9cebcd..5bafea594 100644 --- a/app/Actions/Servers/UpdateServerDetails.php +++ b/app/Actions/Servers/UpdateServerDetails.php @@ -13,16 +13,13 @@ use Pterodactyl\Jobs\RevokeSftpAccessJob; use Pterodactyl\Models\Server; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class UpdateServerDetails implements UpdatesServerDetails { public function __construct(private ExtensionFields $extensions) {} /** - * A server's details: its external id, name, owner and description, checked as they - * are when a server is created. Pass the server being updated so its own external id - * is not taken for a duplicate. + * Pass the server being updated so its own external id is not taken for a duplicate. * * @return NormalizedValidationRules */ @@ -38,11 +35,6 @@ final readonly class UpdateServerDetails implements UpdatesServerDetails ]; } - /** - * @param array $input - * - * @throws Throwable - */ public function update(Server $server, array $input): Server { $validated = Validator::validate($input, self::rules($server)); diff --git a/app/Actions/Servers/UpdateServerDockerImage.php b/app/Actions/Servers/UpdateServerDockerImage.php index 5ed50802b..b22f90544 100644 --- a/app/Actions/Servers/UpdateServerDockerImage.php +++ b/app/Actions/Servers/UpdateServerDockerImage.php @@ -7,17 +7,9 @@ namespace Pterodactyl\Actions\Servers; use Pterodactyl\Contracts\Servers\UpdatesServerDockerImage; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\Server; -use Throwable; final readonly class UpdateServerDockerImage implements UpdatesServerDockerImage { - /** - * Set the Docker image a server runs on without touching its startup command - * or install script settings. The image is not checked against the egg, so - * authorize and validate it first. - * - * @throws Throwable - */ public function update(Server $server, string $image): Server { $original = $server->image; diff --git a/app/Actions/Servers/UpdateServerStartup.php b/app/Actions/Servers/UpdateServerStartup.php index c3bae950a..d5f89f1ea 100644 --- a/app/Actions/Servers/UpdateServerStartup.php +++ b/app/Actions/Servers/UpdateServerStartup.php @@ -15,7 +15,6 @@ use Pterodactyl\Models\Egg; use Pterodactyl\Models\Server; use Pterodactyl\Models\User; use Pterodactyl\Services\Servers\VariableValidatorService; -use Throwable; use UnexpectedValueException; final readonly class UpdateServerStartup implements UpdatesServerStartup @@ -28,10 +27,8 @@ final readonly class UpdateServerStartup implements UpdatesServerStartup ) {} /** - * A server's startup fields at the given user level. The environment maps each egg - * variable to its value, which the egg's own variable rules check. Only an administrator - * changes the startup command, egg, Docker image and install script flag, so below the - * admin level the environment is the only field. + * The environment maps each egg variable to its value, which the egg's own variable rules + * check. Below the admin level the environment is the only field. * * @return NormalizedValidationRules */ @@ -52,11 +49,6 @@ final readonly class UpdateServerStartup implements UpdatesServerStartup ]; } - /** - * @param array $input - * - * @throws Throwable - */ public function update(Server $server, array $input, int $userLevel = User::USER_LEVEL_USER): Server { // Only the fields given are validated, and fields above the user level are ignored. diff --git a/app/Actions/Subusers/CreateSubuser.php b/app/Actions/Subusers/CreateSubuser.php index 0e16a0360..8040a0c9a 100644 --- a/app/Actions/Subusers/CreateSubuser.php +++ b/app/Actions/Subusers/CreateSubuser.php @@ -18,16 +18,13 @@ use Pterodactyl\Models\Subuser; use Pterodactyl\Models\User; use Pterodactyl\Rules\UserEmail; use Pterodactyl\Services\Servers\SubuserPermissionCatalog; -use Throwable; final readonly class CreateSubuser implements CreatesSubusers { public function __construct(private CreatesUsers $users, private SubuserPermissionCatalog $catalog) {} /** - * A subuser's fields: the email address of the user to give access, who is invited when - * no account has it, and the permission keys to grant. Pass the keys that can be granted - * to hold each permission to them. + * Pass the keys that can be granted to hold each permission to them. * * @param list|null $grantable * @return NormalizedValidationRules @@ -41,18 +38,6 @@ final readonly class CreateSubuser implements CreatesSubusers ]; } - /** - * Creates a new user on the system and assigns them access to the provided server. - * If the email address already belongs to a user on the system a new user will not - * be created. The returned subuser's user reports wasRecentlyCreated when one was. - * - * @param list $permissions The permission keys to grant, deduplicated - * before they are stored. - * - * @throws ServerSubuserExistsException - * @throws UserIsServerOwnerException - * @throws Throwable - */ public function create(Server $server, string $email, array $permissions): Subuser { Validator::validate(['email' => $email, 'permissions' => $permissions], self::rules($this->catalog->keys())); diff --git a/app/Actions/Subusers/DeleteSubuser.php b/app/Actions/Subusers/DeleteSubuser.php index e7d113f6e..af45ce967 100644 --- a/app/Actions/Subusers/DeleteSubuser.php +++ b/app/Actions/Subusers/DeleteSubuser.php @@ -11,15 +11,9 @@ use Pterodactyl\Facades\Activity; use Pterodactyl\Jobs\RevokeSftpAccessJob; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; -use Throwable; final readonly class DeleteSubuser implements DeletesSubusers { - /** - * Removes the subuser from the server and revokes their outstanding SFTP sessions on Wings. - * - * @throws Throwable - */ public function delete(Server $server, Subuser $subuser): void { DB::transaction(function () use ($server, $subuser): void { diff --git a/app/Actions/Subusers/UpdateSubuser.php b/app/Actions/Subusers/UpdateSubuser.php index ed19a139f..257de6d9b 100644 --- a/app/Actions/Subusers/UpdateSubuser.php +++ b/app/Actions/Subusers/UpdateSubuser.php @@ -14,20 +14,11 @@ use Pterodactyl\Jobs\RevokeSftpAccessJob; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; use Pterodactyl\Services\Servers\SubuserPermissionCatalog; -use Throwable; final readonly class UpdateSubuser implements UpdatesSubusers { public function __construct(private SubuserPermissionCatalog $catalog) {} - /** - * Replaces the subuser's permissions and revokes their outstanding SFTP sessions on Wings. - * Permissions that are already the subuser's, in any order, change nothing. - * - * @param list $permissions - * - * @throws Throwable - */ public function update(Server $server, Subuser $subuser, array $permissions): Subuser { // A permission the subuser already holds stays grantable even once nothing defines diff --git a/app/Actions/Tags/CreateTag.php b/app/Actions/Tags/CreateTag.php index 49c627b3e..f1fb09523 100644 --- a/app/Actions/Tags/CreateTag.php +++ b/app/Actions/Tags/CreateTag.php @@ -13,9 +13,9 @@ use Pterodactyl\Rules\TagSlug; final readonly class CreateTag implements CreatesTags { /** - * A tag's fields. Pass the tag being edited so its own slug does not collide with the - * uniqueness check. A slug may not be purely numeric, so a leftover legacy nest id can be - * told apart from a real tag and a slug can never shadow a tag id (see TagSlug). + * Pass the tag being edited so its own slug does not collide with the uniqueness check. A + * slug may not be purely numeric, so a leftover legacy nest id can be told apart from a real + * tag and a slug can never shadow a tag id (see TagSlug). * * @return NormalizedValidationRules */ @@ -31,9 +31,6 @@ final readonly class CreateTag implements CreatesTags ]; } - /** - * @param array $input - */ public function create(array $input): Tag { $validated = Validator::validate($input, self::rules()); diff --git a/app/Actions/Tags/DeleteTag.php b/app/Actions/Tags/DeleteTag.php index 9d32d1a30..553bf5340 100644 --- a/app/Actions/Tags/DeleteTag.php +++ b/app/Actions/Tags/DeleteTag.php @@ -11,15 +11,10 @@ use Pterodactyl\Models\Tag; final readonly class DeleteTag implements DeletesTags { - /** - * Delete a tag and detach it from every egg and node. Built-in game tags cannot be - * deleted because the cascading pivot cleanup would discard every egg and node - * assignment, and recreating the tag later cannot restore those associations. - * - * @throws DisplayException - */ public function delete(Tag $tag): void { + // The cascading pivot cleanup would discard every egg and node assignment of a built-in + // tag, and recreating the tag later cannot restore them. throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, 'Built-in game tags cannot be deleted.'); $tag->delete(); diff --git a/app/Actions/Tags/SyncTags.php b/app/Actions/Tags/SyncTags.php index 5c6de0d53..ec50e6795 100644 --- a/app/Actions/Tags/SyncTags.php +++ b/app/Actions/Tags/SyncTags.php @@ -27,12 +27,7 @@ final readonly class SyncTags implements SyncsTags public function __construct(private TagResolutionService $resolver) {} - /** - * The tags to sync, each an existing tag's id or a new tag's name. An id may also be an - * integer. - * - * @return NormalizedValidationRules - */ + /** @return NormalizedValidationRules */ public static function rules(): array { return [ @@ -45,8 +40,7 @@ final readonly class SyncTags implements SyncsTags } /** - * Validates tag values under `tags` and returns them as strings for the resolver, an - * integer id becoming the numeric string the panel sends. + * An integer id becomes the numeric string the panel sends. * * @param list $values * @return list @@ -58,19 +52,16 @@ final readonly class SyncTags implements SyncsTags return array_map(fn (int|string $key): string => $input->string('tags.'.$key)->toString(), array_keys($input->array('tags'))); } - /** @param list $values */ public function syncEgg(Egg $egg, array $values): void { $this->sync($egg, $egg->tags(), self::values($values)); } - /** @param list $values */ public function syncNodeGames(Node $node, array $values): void { $this->sync($node, $node->eggTags(), self::values($values), $node->deploymentTags()); } - /** @param list $values */ public function syncNodeDeployments(Node $node, array $values): void { $this->sync($node, $node->deploymentTags(), self::values($values), $node->eggTags()); diff --git a/app/Actions/Tags/UpdateTag.php b/app/Actions/Tags/UpdateTag.php index 1411c5e2c..6e78de58d 100644 --- a/app/Actions/Tags/UpdateTag.php +++ b/app/Actions/Tags/UpdateTag.php @@ -12,17 +12,10 @@ use Pterodactyl\Models\Tag; final readonly class UpdateTag implements UpdatesTags { - /** - * Update an existing tag. A built-in game tag's slug is the key feature gating matches on - * and its presentation comes from the EggSpecificTags enum, so it must never be renamed or - * relabelled. - * - * @param array $input - * - * @throws DisplayException - */ public function update(Tag $tag, array $input): Tag { + // Feature gating matches on a built-in tag's slug and EggSpecificTags owns its + // presentation, so it is never renamed or relabelled. throw_if(EggSpecificTags::isSpecial($tag->slug), DisplayException::class, 'Built-in game tags cannot be edited.'); $validated = Validator::validate($input, CreateTag::rules($tag)); diff --git a/app/Actions/Themes/ApplyTheme.php b/app/Actions/Themes/ApplyTheme.php index a02ec5a34..5a4a2a732 100644 --- a/app/Actions/Themes/ApplyTheme.php +++ b/app/Actions/Themes/ApplyTheme.php @@ -16,7 +16,6 @@ final readonly class ApplyTheme implements AppliesThemes { public function __construct(private ThemeService $themes, private FilesystemChanges $files) {} - /** Publish a theme's tokens.css (and optional assets/ directory). */ public function apply(string $id): void { $theme = $this->themes->discovered()[$id] ?? null; diff --git a/app/Actions/Themes/ResetTheme.php b/app/Actions/Themes/ResetTheme.php index ccf5a4e33..dfde0e0fe 100644 --- a/app/Actions/Themes/ResetTheme.php +++ b/app/Actions/Themes/ResetTheme.php @@ -12,7 +12,6 @@ final readonly class ResetTheme implements ResetsThemes { public function __construct(private ThemeService $themes, private FilesystemChanges $files) {} - /** Remove the published theme, restoring the stock look. */ public function reset(): void { $this->files->run([ diff --git a/app/Actions/Transfers/CompleteTransfer.php b/app/Actions/Transfers/CompleteTransfer.php index 0c8488f8d..6ee5226d7 100644 --- a/app/Actions/Transfers/CompleteTransfer.php +++ b/app/Actions/Transfers/CompleteTransfer.php @@ -14,15 +14,9 @@ use Pterodactyl\Facades\Daemon; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Server; use Pterodactyl\Models\ServerTransfer; -use Throwable; final readonly class CompleteTransfer implements CompletesTransfers { - /** - * Moves the server onto its new node and allocations, then removes it from the old node. - * - * @throws Throwable - */ public function complete(ServerTransfer $transfer): Server { $server = DB::transaction(function () use ($transfer): Server { diff --git a/app/Actions/Transfers/FailTransfer.php b/app/Actions/Transfers/FailTransfer.php index 52b59e0c4..ec2f3fcd6 100644 --- a/app/Actions/Transfers/FailTransfer.php +++ b/app/Actions/Transfers/FailTransfer.php @@ -10,15 +10,9 @@ use Pterodactyl\Contracts\Transfers\FailsTransfers; use Pterodactyl\Events\Server\OperationCompleted; use Pterodactyl\Models\Allocation; use Pterodactyl\Models\ServerTransfer; -use Throwable; final readonly class FailTransfer implements FailsTransfers { - /** - * Marks the transfer as failed and releases the allocations reserved on the target node. - * - * @throws Throwable - */ public function fail(ServerTransfer $transfer): void { DB::transaction(function () use ($transfer): void { diff --git a/app/Actions/Transfers/InitiateTransfer.php b/app/Actions/Transfers/InitiateTransfer.php index 06df83624..ec64399bd 100644 --- a/app/Actions/Transfers/InitiateTransfer.php +++ b/app/Actions/Transfers/InitiateTransfer.php @@ -33,11 +33,7 @@ final readonly class InitiateTransfer implements InitiatesTransfers ) {} /** - * A transfer's fields: a node other than the server's own, the allocation the server - * takes as its default there, and any additional ones. The default allocation must - * exist and be no server's default; the additional ones are integers or numeric - * strings. Once these pass, validateAllocations() checks the allocations are free and - * on the node. + * Once these pass, validateAllocations() checks the allocations are free and on the node. * * @return NormalizedValidationRules */ @@ -78,17 +74,6 @@ final readonly class InitiateTransfer implements InitiatesTransfers } } - /** - * Records the transfer, reserves the target allocations, and tells the destination - * node to begin pulling the server. Wings is called after the records commit; if it - * rejects the transfer, it is marked failed and its allocations are released. - * - * @param list $additionalAllocations - * - * @throws DisplayException - * @throws ValidationException - * @throws Throwable - */ public function initiate(Server $server, Node $node, int $allocationId, array $additionalAllocations): ServerTransfer { $additionalAllocations = $this->additionalAllocations($server, $node, $allocationId, $additionalAllocations); @@ -147,9 +132,8 @@ final readonly class InitiateTransfer implements InitiatesTransfers } /** - * Validates the transfer of the server to the node and returns the additional - * allocations, as integers. Missing additional allocations fail `allocation_additional.N` - * as an exists rule would, all looked up in one query. + * Missing additional allocations fail `allocation_additional.N` as an exists rule would, all + * looked up in one query. * * @param list $additionalAllocations * @return list diff --git a/app/Actions/Users/CreateSshKey.php b/app/Actions/Users/CreateSshKey.php index 0b89b1b02..8376db834 100644 --- a/app/Actions/Users/CreateSshKey.php +++ b/app/Actions/Users/CreateSshKey.php @@ -5,7 +5,6 @@ declare(strict_types=1); namespace Pterodactyl\Actions\Users; use Illuminate\Support\Facades\Validator; -use Illuminate\Validation\ValidationException; use Pterodactyl\Contracts\Users\CreatesSshKeys; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\User; @@ -37,8 +36,7 @@ final readonly class CreateSshKey implements CreatesSshKeys ]; /** - * An SSH key's fields: its name, the public key and the key's fingerprint. A key a - * request parses is first held to PUBLIC_KEY_MAX_LENGTH and isSupportedPublicKey(). + * A key a request parses is first held to PUBLIC_KEY_MAX_LENGTH and isSupportedPublicKey(). * * @return NormalizedValidationRules */ @@ -73,7 +71,6 @@ final readonly class CreateSshKey implements CreatesSshKeys return false; } - /** @throws ValidationException */ public function create(User $user, string $name, string $publicKey, string $fingerprint): UserSSHKey { $attributes = Validator::validate(['name' => $name, 'public_key' => $publicKey, 'fingerprint' => $fingerprint], self::rules()); diff --git a/app/Actions/Users/CreateUser.php b/app/Actions/Users/CreateUser.php index 50fdefc9c..524c5b687 100644 --- a/app/Actions/Users/CreateUser.php +++ b/app/Actions/Users/CreateUser.php @@ -19,7 +19,6 @@ use Pterodactyl\Rules\UserEmail; use Pterodactyl\Rules\Username; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class CreateUser implements CreatesUsers { @@ -37,8 +36,8 @@ final readonly class CreateUser implements CreatesUsers } /** - * A user's fields. Pass the user being updated so its own email, username and external - * id are not taken for duplicates. + * Pass the user being updated so its own email, username and external id are not taken for + * duplicates. * * @return NormalizedValidationRules */ @@ -56,17 +55,6 @@ final readonly class CreateUser implements CreatesUsers ]; } - /** - * Create a new user on the system. When no password is provided a random one is - * set and a password reset token is generated for the account welcome email. - * - * The UUID and password hash are handled by the model itself (HasVersion4Uuids - * and the hashed password cast). - * - * @param array $input - * - * @throws Throwable - */ public function create(array $input): User { $attributes = Validator::validate($input, self::rules()); diff --git a/app/Actions/Users/DeleteUser.php b/app/Actions/Users/DeleteUser.php index e65f96a6f..5becd0867 100644 --- a/app/Actions/Users/DeleteUser.php +++ b/app/Actions/Users/DeleteUser.php @@ -10,11 +10,6 @@ use Pterodactyl\Models\User; final class DeleteUser implements DeletesUsers { - /** - * Delete a user from the panel only if they have no servers attached to their account. - * - * @throws DisplayException - */ public function delete(User $user): ?bool { if ($user->servers()->exists()) { diff --git a/app/Actions/Users/SetupTwoFactor.php b/app/Actions/Users/SetupTwoFactor.php index a8cf934cf..c3ec2f4df 100644 --- a/app/Actions/Users/SetupTwoFactor.php +++ b/app/Actions/Users/SetupTwoFactor.php @@ -14,13 +14,6 @@ final readonly class SetupTwoFactor implements SetsUpTwoFactor { public const string VALID_BASE32_CHARACTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'; - /** - * Generate a 2FA token and store it in the database before returning the - * QR code URL. This URL will need to be attached to a QR generating service in - * order to function. - * - * @return array{image_url_data: string, secret: string} - */ public function setup(User $user): array { $secret = ''; diff --git a/app/Actions/Users/ToggleTwoFactor.php b/app/Actions/Users/ToggleTwoFactor.php index 5334fa8f3..f21904147 100644 --- a/app/Actions/Users/ToggleTwoFactor.php +++ b/app/Actions/Users/ToggleTwoFactor.php @@ -8,34 +8,18 @@ use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Str; -use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; -use PragmaRX\Google2FA\Exceptions\InvalidCharactersException; -use PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException; use PragmaRX\Google2FA\Google2FA; use Pterodactyl\Contracts\Users\TogglesTwoFactor; use Pterodactyl\Exceptions\Service\User\TwoFactorAuthenticationTokenInvalid; use Pterodactyl\Facades\Activity; use Pterodactyl\Models\RecoveryToken; use Pterodactyl\Models\User; -use Throwable; use UnexpectedValueException; final readonly class ToggleTwoFactor implements TogglesTwoFactor { public function __construct(private Google2FA $google2FA) {} - /** - * Toggle 2FA on an account only if the token provided is valid. - * - * @return list The plaintext recovery tokens generated for the account, - * empty when 2FA is being turned off. - * - * @throws Throwable - * @throws IncompatibleWithGoogleAuthenticatorException - * @throws InvalidCharactersException - * @throws SecretKeyTooShortException - * @throws TwoFactorAuthenticationTokenInvalid - */ public function toggle(User $user, string $token, ?bool $toggleState = null): array { $encryptedSecret = $user->totp_secret; diff --git a/app/Actions/Users/UpdateUser.php b/app/Actions/Users/UpdateUser.php index e4da302c9..aa6819499 100644 --- a/app/Actions/Users/UpdateUser.php +++ b/app/Actions/Users/UpdateUser.php @@ -11,20 +11,11 @@ use Pterodactyl\Events\User\PasswordChanged; use Pterodactyl\Models\User; use Pterodactyl\Services\Extensions\ExtensionFields; use Pterodactyl\Services\Extensions\ValidatedExtensionValues; -use Throwable; final readonly class UpdateUser implements UpdatesUsers { public function __construct(private ExtensionFields $extensions) {} - /** - * Update the user model instance and return the updated model. The hashed - * password cast on the model takes care of hashing a new password. - * - * @param array $input - * - * @throws Throwable - */ public function update(User $user, array $input): User { $rules = array_map(fn (array $rules): array => ['sometimes', ...$rules], CreateUser::rules($user)); diff --git a/app/Actions/Users/UpdateUserEmail.php b/app/Actions/Users/UpdateUserEmail.php index 3d852925c..73a2d05c1 100644 --- a/app/Actions/Users/UpdateUserEmail.php +++ b/app/Actions/Users/UpdateUserEmail.php @@ -19,9 +19,6 @@ final readonly class UpdateUserEmail implements UpdatesUserEmails public function __construct(private UpdatesUsers $users) {} - /** - * @return array{user: User, original: string, email: string, changed: bool} - */ public function update(User $user, string $email): array { throw_if(RateLimiter::tooManyAttempts($key = $this->throttleKey($user), self::THROTTLE_MAX), TooManyRequestsHttpException::class, 'Your email address has been changed too many times today. Please try again later.'); diff --git a/app/Actions/Users/UpdateUserPassword.php b/app/Actions/Users/UpdateUserPassword.php index 301a327a4..61968eb5c 100644 --- a/app/Actions/Users/UpdateUserPassword.php +++ b/app/Actions/Users/UpdateUserPassword.php @@ -15,10 +15,6 @@ final readonly class UpdateUserPassword implements UpdatesUserPasswords { public function __construct(private UpdatesUsers $users) {} - /** - * Changing a password, through the account page or a reset link, also ends every other - * session and "remember me" login made with the old one. - */ public function update(User $user, string $password): User { $user = $this->users->update($user, ['password' => $password]); diff --git a/app/Contracts/Activity/IngestsActivityLogs.php b/app/Contracts/Activity/IngestsActivityLogs.php index 17bea7523..46da5dfba 100644 --- a/app/Contracts/Activity/IngestsActivityLogs.php +++ b/app/Contracts/Activity/IngestsActivityLogs.php @@ -10,10 +10,9 @@ use Pterodactyl\Models\Node; interface IngestsActivityLogs { /** - * Record the activity a node reported against the servers it runs. The input is the - * report Wings sends, validated here under the field names of its protocol, so it can - * come straight from any caller. Events for servers on other nodes, and events outside - * the `server:` namespace, are dropped. + * Record the activity a node reported against the servers it runs. The input is the report + * Wings sends, validated here under the field names of its protocol. Events for servers on + * other nodes, and events outside the `server:` namespace, are dropped. * * @param array $input data: the events, each with server, event, metadata and timestamp, and optionally user and ip * diff --git a/app/Contracts/Allocations/CreatesAllocations.php b/app/Contracts/Allocations/CreatesAllocations.php index 82cdf5b6f..b2adc6c35 100644 --- a/app/Contracts/Allocations/CreatesAllocations.php +++ b/app/Contracts/Allocations/CreatesAllocations.php @@ -14,9 +14,8 @@ use Pterodactyl\Models\Node; interface CreatesAllocations { /** - * Create the allocations of one address on a node. The input is validated here, so it can - * come straight from any caller. A port that cannot be read, falls outside 1025-65535 or - * opens a range of more than 1000 ports is refused with the exceptions below. + * The input is validated here. A port that cannot be read, falls outside 1025-65535 or opens + * a range of more than 1000 ports is refused with the exceptions below. * * @param array $input allocation_ip (an IP address, CIDR range or hostname), allocation_ports (port numbers, or ranges such as "25565-25570") and optionally allocation_alias * diff --git a/app/Contracts/Allocations/DeletesAllocations.php b/app/Contracts/Allocations/DeletesAllocations.php index 8596064ff..588b6cda2 100644 --- a/app/Contracts/Allocations/DeletesAllocations.php +++ b/app/Contracts/Allocations/DeletesAllocations.php @@ -10,7 +10,7 @@ use Pterodactyl\Models\Allocation; interface DeletesAllocations { /** - * Delete an allocation, provided no server is attached to it. + * An allocation a server is using is not deleted. * * @throws ServerUsingAllocationException */ diff --git a/app/Contracts/Api/CreatesAccountApiKeys.php b/app/Contracts/Api/CreatesAccountApiKeys.php index f92e5aff7..250413e9f 100644 --- a/app/Contracts/Api/CreatesAccountApiKeys.php +++ b/app/Contracts/Api/CreatesAccountApiKeys.php @@ -11,10 +11,9 @@ use Pterodactyl\Models\User; interface CreatesAccountApiKeys { /** - * Create an account API key for the user, who may hold at most 25. The description and - * the allowed IPs are validated here, so they can come straight from any caller: the - * description is required, and each allowed IP must be an IP address or a CIDR range. - * A key given no allowed IPs can be used from any address. + * A user holds at most 25 account keys. The description and the allowed IPs are validated + * here: the description is required, and each allowed IP must be an IP address or a CIDR + * range. A key given no allowed IPs can be used from any address. * * @param list|null $allowedIps * diff --git a/app/Contracts/Api/CreatesApiKeys.php b/app/Contracts/Api/CreatesApiKeys.php index a1f1ac75a..491f9d3db 100644 --- a/app/Contracts/Api/CreatesApiKeys.php +++ b/app/Contracts/Api/CreatesApiKeys.php @@ -9,11 +9,10 @@ use Pterodactyl\Models\ApiKey; interface CreatesApiKeys { /** - * Create an API key of the given type with a fresh identifier and token. The input and - * the permissions are validated here, so they can come straight from any caller. Each - * allowed IP must be an IP address or a CIDR range. The permissions are only applied to - * application keys: each is AdminAcl::NONE or AdminAcl::READ and AdminAcl::WRITE - * combined, and a resource left out gets AdminAcl::NONE. + * The input and the permissions are validated here, and each allowed IP must be an IP + * address or a CIDR range. The permissions only apply to application keys: each is + * AdminAcl::NONE or AdminAcl::READ and AdminAcl::WRITE combined, and a resource left out + * gets AdminAcl::NONE. * * @param array $input memo and user_id, and optionally allowed_ips * @param array $permissions the r_* column of any AdminAcl resource diff --git a/app/Contracts/Api/UpdatesApiKeys.php b/app/Contracts/Api/UpdatesApiKeys.php index ea11014e3..f4aabc71b 100644 --- a/app/Contracts/Api/UpdatesApiKeys.php +++ b/app/Contracts/Api/UpdatesApiKeys.php @@ -9,9 +9,8 @@ use Pterodactyl\Models\ApiKey; interface UpdatesApiKeys { /** - * Update an API key's attributes without regenerating its token. The input and the - * permissions are validated here, so they can come straight from any caller. Only what - * is given changes, and the permissions are only applied to application keys. + * The token is kept. The input and the permissions are validated here, only what is given + * changes, and the permissions only apply to application keys. * * @param array $input optionally memo * @param array $permissions the r_* column of any AdminAcl resource diff --git a/app/Contracts/Backups/CompletesBackups.php b/app/Contracts/Backups/CompletesBackups.php index 4b25f91bd..6aaa9c857 100644 --- a/app/Contracts/Backups/CompletesBackups.php +++ b/app/Contracts/Backups/CompletesBackups.php @@ -12,10 +12,10 @@ use Throwable; interface CompletesBackups { /** - * Record the outcome Wings reported for a backup. The input is validated here, so it can - * come straight from any caller, under the field names of the Wings protocol. A - * successful backup needs its checksum, checksum type and size; S3 parts left out are - * listed from S3 when the multipart upload is completed. + * Record the outcome Wings reported for a backup and complete or abort its S3 multipart + * upload. The input is validated here under the field names of the Wings protocol: a + * successful backup needs its checksum, checksum type and size, and S3 parts left out are + * listed from S3. * * @param array $input successful, checksum, checksum_type, size and optionally parts, each with an etag and part_number * diff --git a/app/Contracts/Backups/DeletesBackups.php b/app/Contracts/Backups/DeletesBackups.php index 89c8d3ee9..ef18e63f4 100644 --- a/app/Contracts/Backups/DeletesBackups.php +++ b/app/Contracts/Backups/DeletesBackups.php @@ -9,6 +9,10 @@ use Throwable; interface DeletesBackups { - /** @throws Throwable */ + /** + * An S3 backup's archive is deleted from its bucket as well. + * + * @throws Throwable + */ public function delete(Backup $backup): void; } diff --git a/app/Contracts/Backups/GeneratesBackupDownloadLinks.php b/app/Contracts/Backups/GeneratesBackupDownloadLinks.php index c151436c8..c0109e889 100644 --- a/app/Contracts/Backups/GeneratesBackupDownloadLinks.php +++ b/app/Contracts/Backups/GeneratesBackupDownloadLinks.php @@ -9,5 +9,9 @@ use Pterodactyl\Models\User; interface GeneratesBackupDownloadLinks { + /** + * A short-lived link the user can download the backup from: a presigned S3 URL, or a signed + * link to the backup on its node. + */ public function generate(Backup $backup, User $user): string; } diff --git a/app/Contracts/Backups/InitiatesBackups.php b/app/Contracts/Backups/InitiatesBackups.php index 132ce2d64..3c3e9dc8c 100644 --- a/app/Contracts/Backups/InitiatesBackups.php +++ b/app/Contracts/Backups/InitiatesBackups.php @@ -5,11 +5,15 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Backups; use Illuminate\Validation\ValidationException; +use Pterodactyl\Exceptions\Service\Backup\TooManyBackupsException; use Pterodactyl\Models\Backup; use Pterodactyl\Models\Server; +use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; +use Throwable; interface InitiatesBackups { + /** A locked backup cannot be deleted by users or by automated processes. */ public function setIsLocked(bool $isLocked): self; /** @@ -20,12 +24,19 @@ interface InitiatesBackups public function setIgnoredFiles(?array $ignored): self; /** - * Start a backup of the server on Wings. The name and the ignored files are validated - * here, so they can come straight from any caller: 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. + * 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. * + * 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 * @throws ValidationException + * @throws Throwable */ public function initiate(Server $server, ?string $name = null, bool $override = false): Backup; } diff --git a/app/Contracts/Backups/PresignsBackupUploads.php b/app/Contracts/Backups/PresignsBackupUploads.php index 4f11ccabf..1f80af525 100644 --- a/app/Contracts/Backups/PresignsBackupUploads.php +++ b/app/Contracts/Backups/PresignsBackupUploads.php @@ -9,7 +9,12 @@ use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; interface PresignsBackupUploads { - /** @return BackupUploadParts + /** + * Open a multipart upload for the backup in S3 and return one presigned URL per part Wings + * needs to upload an archive of the given size. + * + * @return BackupUploadParts + * * @throws BadRequestHttpException */ public function presign(Backup $backup, int $size): array; diff --git a/app/Contracts/Backups/RestoresBackups.php b/app/Contracts/Backups/RestoresBackups.php index ca89106cb..b7ff596f1 100644 --- a/app/Contracts/Backups/RestoresBackups.php +++ b/app/Contracts/Backups/RestoresBackups.php @@ -11,6 +11,11 @@ use Throwable; interface RestoresBackups { - /** @throws Throwable */ + /** + * Mark the server as restoring and ask Wings to unpack the backup over its files, deleting + * them first when $truncate is set. + * + * @throws Throwable + */ public function restore(Server $server, Backup $backup, User $user, bool $truncate): void; } diff --git a/app/Contracts/Core/ReceivesEvents.php b/app/Contracts/Core/ReceivesEvents.php index cdf4f0a38..73ee53018 100644 --- a/app/Contracts/Core/ReceivesEvents.php +++ b/app/Contracts/Core/ReceivesEvents.php @@ -8,8 +8,5 @@ use Pterodactyl\Events\Event; interface ReceivesEvents { - /** - * Handles receiving an event from the application. - */ public function handle(Event $notification): void; } diff --git a/app/Contracts/Databases/CreatesDatabaseHosts.php b/app/Contracts/Databases/CreatesDatabaseHosts.php index 23116fd7a..033990d5c 100644 --- a/app/Contracts/Databases/CreatesDatabaseHosts.php +++ b/app/Contracts/Databases/CreatesDatabaseHosts.php @@ -10,10 +10,9 @@ use Throwable; interface CreatesDatabaseHosts { /** - * Create a new database host once the Panel has connected to it with the given - * credentials. The input is validated here, so it can come straight from any caller; - * extension field values go under `extensions` as ValidatedExtensionValues. The password - * is stored encrypted, and a host given no node_id is global. + * The host is saved once the Panel has connected to it with the given credentials. The input + * is validated here and the password is stored encrypted; a host given no node_id is global. + * Extension field values go under `extensions` as ValidatedExtensionValues. * * @param array $input name, host, port and username, and optionally password and node_id * diff --git a/app/Contracts/Databases/CreatesDatabases.php b/app/Contracts/Databases/CreatesDatabases.php index 2468e51e5..88b3a8ef5 100644 --- a/app/Contracts/Databases/CreatesDatabases.php +++ b/app/Contracts/Databases/CreatesDatabases.php @@ -15,10 +15,9 @@ interface CreatesDatabases public function setValidateDatabaseLimit(bool $validate): self; /** - * Create a database for a server on the given database host. The input is validated here, - * so it can come straight from any caller. The name must already carry the server's - * "s{server_id}_" prefix (see DatabaseName::generateUnique()); a database given no - * max_connections takes the column default. + * The input is validated here. The name must already carry the server's "s{server_id}_" + * prefix (see DatabaseName::generateUnique()), and a database given no max_connections takes + * the column default. * * @param array $input database, remote and database_host_id, and optionally max_connections * diff --git a/app/Contracts/Databases/DeletesDatabaseHosts.php b/app/Contracts/Databases/DeletesDatabaseHosts.php index 56ad88e71..f733bdd01 100644 --- a/app/Contracts/Databases/DeletesDatabaseHosts.php +++ b/app/Contracts/Databases/DeletesDatabaseHosts.php @@ -9,6 +9,10 @@ use Pterodactyl\Models\DatabaseHost; interface DeletesDatabaseHosts { - /** @throws HasActiveServersException */ + /** + * A host with databases on it is not deleted. + * + * @throws HasActiveServersException + */ public function delete(DatabaseHost $host): void; } diff --git a/app/Contracts/Databases/DeploysServerDatabases.php b/app/Contracts/Databases/DeploysServerDatabases.php index f22308a9b..99aea314c 100644 --- a/app/Contracts/Databases/DeploysServerDatabases.php +++ b/app/Contracts/Databases/DeploysServerDatabases.php @@ -15,10 +15,9 @@ use Throwable; interface DeploysServerDatabases { /** - * Create a database for a server within its database limit, prefixing the name with - * "s{server_id}_". With no database_host_id, a host on the server's node is picked, or - * any host when random hosts are allowed. The input is validated here, so it can come - * straight from any caller. + * Create a database within the server's database limit, prefixing the name with + * "s{server_id}_". With no database_host_id, a host on the server's node is picked, or any + * host when random hosts are allowed. The input is validated here. * * @param array $input database and remote, and optionally database_host_id and max_connections * diff --git a/app/Contracts/Databases/UpdatesDatabaseHosts.php b/app/Contracts/Databases/UpdatesDatabaseHosts.php index d9200b812..0a476aa64 100644 --- a/app/Contracts/Databases/UpdatesDatabaseHosts.php +++ b/app/Contracts/Databases/UpdatesDatabaseHosts.php @@ -10,11 +10,10 @@ use Throwable; interface UpdatesDatabaseHosts { /** - * Update a database host once the Panel has connected to it with the new credentials. - * The input is validated here, so it can come straight from any caller. It takes the - * fields a host is created with, required ones included; a blank password keeps the - * stored one, and a host given no node_id becomes global. Extension field values go under - * `extensions` as ValidatedExtensionValues. + * The host is saved once the Panel has connected to it with the new credentials. The input + * is validated here and takes the fields a host is created with, required ones included; a + * blank password keeps the stored one, and a host given no node_id becomes global. Extension + * field values go under `extensions` as ValidatedExtensionValues. * * @param array $input the fields a host is created with * diff --git a/app/Contracts/Eggs/CreatesEggVariables.php b/app/Contracts/Eggs/CreatesEggVariables.php index b2fbcca5d..d560b6416 100644 --- a/app/Contracts/Eggs/CreatesEggVariables.php +++ b/app/Contracts/Eggs/CreatesEggVariables.php @@ -10,10 +10,9 @@ use Pterodactyl\Models\EggVariable; interface CreatesEggVariables { /** - * Create a new variable for a given Egg. The input is validated here, so it can come - * straight from any caller: the environment variable name must be unique among the egg's - * variables and not one the panel reserves, and the rules must be a valid rule set. - * Listing user_viewable or user_editable in options lets users see or edit the variable. + * The input is validated here: the environment variable name must be unique among the egg's + * variables and not one the panel reserves, and the rules must be a valid rule set. Listing + * user_viewable or user_editable in options lets users see or edit the variable. * * @param array $input name, env_variable, rules and default_value, and optionally description and options */ diff --git a/app/Contracts/Eggs/CreatesEggs.php b/app/Contracts/Eggs/CreatesEggs.php index 28a0cb71a..4205f78fe 100644 --- a/app/Contracts/Eggs/CreatesEggs.php +++ b/app/Contracts/Eggs/CreatesEggs.php @@ -9,11 +9,11 @@ use Pterodactyl\Models\Egg; interface CreatesEggs { /** - * Create an egg, stamping the configured service author. The input is validated here, - * so it can come straight from any caller; extension field values go under `extensions` - * as ValidatedExtensionValues. The Docker images are a newline-separated string, each line - * an image optionally prefixed with its display name and a pipe. An egg given a - * config_from copies its config from that egg and needs no config blocks of its own. + * The egg is stamped with the configured service author. The input is validated here. The + * Docker images are a newline-separated string, each line an image optionally prefixed with + * its display name and a pipe. An egg given a config_from copies its config from that egg + * and needs no config blocks of its own. Extension field values go under `extensions` as + * ValidatedExtensionValues. * * @param array $input name, docker_images and startup, and optionally description, force_outgoing_ip, features, file_denylist, config_from, config_stop, config_startup, config_logs and config_files */ diff --git a/app/Contracts/Eggs/DeletesEggVariables.php b/app/Contracts/Eggs/DeletesEggVariables.php index f0dacdf46..1f1c62652 100644 --- a/app/Contracts/Eggs/DeletesEggVariables.php +++ b/app/Contracts/Eggs/DeletesEggVariables.php @@ -8,8 +8,5 @@ use Pterodactyl\Models\EggVariable; interface DeletesEggVariables { - /** - * Delete an egg variable. - */ public function delete(EggVariable $variable): void; } diff --git a/app/Contracts/Eggs/DeletesEggs.php b/app/Contracts/Eggs/DeletesEggs.php index 598e48ded..d5c74944b 100644 --- a/app/Contracts/Eggs/DeletesEggs.php +++ b/app/Contracts/Eggs/DeletesEggs.php @@ -11,8 +11,8 @@ use Pterodactyl\Models\Egg; interface DeletesEggs { /** - * Delete an egg, provided no servers use it and no eggs inherit their - * configuration from it. + * An egg that servers use, or that other eggs inherit their configuration from, is not + * deleted. * * @throws HasActiveServersException * @throws HasChildrenException diff --git a/app/Contracts/Eggs/ReordersEggVariables.php b/app/Contracts/Eggs/ReordersEggVariables.php index 18370b5af..479158af7 100644 --- a/app/Contracts/Eggs/ReordersEggVariables.php +++ b/app/Contracts/Eggs/ReordersEggVariables.php @@ -10,8 +10,8 @@ interface ReordersEggVariables { /** * Give the egg's variables the sort order of their position in the list. The ids are - * validated here, so they can come straight from any caller: each is an integer or a - * numeric string, listed once. An id of a variable on another egg is skipped. + * validated here: each is an integer or a numeric string, listed once. An id of a variable + * on another egg is skipped. * * @param list $order the variable ids in their new order */ diff --git a/app/Contracts/Eggs/UpdatesEggInstallScripts.php b/app/Contracts/Eggs/UpdatesEggInstallScripts.php index 2d8494649..4112b0d03 100644 --- a/app/Contracts/Eggs/UpdatesEggInstallScripts.php +++ b/app/Contracts/Eggs/UpdatesEggInstallScripts.php @@ -10,8 +10,7 @@ use Pterodactyl\Models\Egg; interface UpdatesEggInstallScripts { /** - * Modify the install script for a given Egg. The input is validated here, so it can come - * straight from any caller, and only the fields given are changed. An egg to copy the + * The input is validated here, and only the fields given are changed. An egg to copy the * script from must have a script of its own. * * @param array $input any of script_install, script_is_privileged, script_entry, script_container and copy_script_from diff --git a/app/Contracts/Eggs/UpdatesEggVariables.php b/app/Contracts/Eggs/UpdatesEggVariables.php index 357fbbf43..38c403c1a 100644 --- a/app/Contracts/Eggs/UpdatesEggVariables.php +++ b/app/Contracts/Eggs/UpdatesEggVariables.php @@ -9,10 +9,9 @@ use Pterodactyl\Models\EggVariable; interface UpdatesEggVariables { /** - * Update an egg variable. The input is validated here, so it can come straight from any - * caller. It takes the fields a variable is created with, required ones included; a - * description left out is blanked, and the variable can only be seen or edited by users - * when options lists user_viewable or user_editable. The variable keeps its own + * The input is validated here and takes the fields a variable is created with, required ones + * included; a description left out is blanked, and the variable can only be seen or edited + * by users when options lists user_viewable or user_editable. The variable keeps its own * environment variable name without it counting as taken. * * @param array $input the fields a variable is created with diff --git a/app/Contracts/Eggs/UpdatesEggs.php b/app/Contracts/Eggs/UpdatesEggs.php index 63d004277..d76b67148 100644 --- a/app/Contracts/Eggs/UpdatesEggs.php +++ b/app/Contracts/Eggs/UpdatesEggs.php @@ -9,11 +9,10 @@ use Pterodactyl\Models\Egg; interface UpdatesEggs { /** - * Update an egg. The input is validated here, so it can come straight from any caller. - * It takes the fields an egg is created with, required ones included; a description, - * outgoing IP flag or features left out are cleared, while the parent egg and config - * blocks left out keep their stored values. The file denylist cannot be changed here. - * Extension field values go under `extensions` as ValidatedExtensionValues. + * The input is validated here and takes the fields an egg is created with, required ones + * included; a description, outgoing IP flag or features left out are cleared, while the + * parent egg and config blocks left out keep their stored values. The file denylist cannot + * be changed here. Extension field values go under `extensions` as ValidatedExtensionValues. * * @param array $input the fields an egg is created with */ diff --git a/app/Contracts/Extensions/HashidsInterface.php b/app/Contracts/Extensions/HashidsInterface.php index b63de0423..926963129 100644 --- a/app/Contracts/Extensions/HashidsInterface.php +++ b/app/Contracts/Extensions/HashidsInterface.php @@ -9,10 +9,6 @@ use InvalidArgumentException; interface HashidsInterface extends VendorHashidsInterface { - /** - * Decode an encoded hashid and return the first result. - * - * @throws InvalidArgumentException - */ + /** @throws InvalidArgumentException */ public function decodeFirst(string $encoded, ?string $default = null): int|string|null; } diff --git a/app/Contracts/Extensions/InstallsExtensions.php b/app/Contracts/Extensions/InstallsExtensions.php index dee4b1a79..594d47a7e 100644 --- a/app/Contracts/Extensions/InstallsExtensions.php +++ b/app/Contracts/Extensions/InstallsExtensions.php @@ -10,8 +10,7 @@ use Pterodactyl\Services\Extensions\ExtensionManifest; interface InstallsExtensions { /** - * Install a package. One whose id is already installed replaces that extension only - * when $replace is set. + * A package whose id is already installed replaces that extension only when $replace is set. * * @throws ExtensionAlreadyInstalledException */ diff --git a/app/Contracts/Http/ClientPermissionsRequest.php b/app/Contracts/Http/ClientPermissionsRequest.php index c1a711dce..cd0821e42 100644 --- a/app/Contracts/Http/ClientPermissionsRequest.php +++ b/app/Contracts/Http/ClientPermissionsRequest.php @@ -6,10 +6,6 @@ namespace Pterodactyl\Contracts\Http; interface ClientPermissionsRequest { - /** - * Returns the permissions string indicating which permission should be used to - * validate that the authenticated user has permission to perform this action against - * the given resource (server). - */ + /** The permission the authenticated user needs on the server for this request. */ public function permission(): string; } diff --git a/app/Contracts/Locations/CreatesLocations.php b/app/Contracts/Locations/CreatesLocations.php index b3249b1b1..4928fdfcc 100644 --- a/app/Contracts/Locations/CreatesLocations.php +++ b/app/Contracts/Locations/CreatesLocations.php @@ -9,8 +9,8 @@ use Pterodactyl\Models\Location; interface CreatesLocations { /** - * Create a new location. The input is validated here, so it can come straight from any caller; - * extension field values go under `extensions` as ValidatedExtensionValues. + * The input is validated here. Extension field values go under `extensions` as + * ValidatedExtensionValues. * * @param array $input short and long */ diff --git a/app/Contracts/Locations/DeletesLocations.php b/app/Contracts/Locations/DeletesLocations.php index 970448019..a5ffe8de9 100644 --- a/app/Contracts/Locations/DeletesLocations.php +++ b/app/Contracts/Locations/DeletesLocations.php @@ -10,7 +10,7 @@ use Pterodactyl\Models\Location; interface DeletesLocations { /** - * Delete a location, provided no nodes are assigned to it. + * A location with nodes assigned to it is not deleted. * * @throws HasActiveNodesException */ diff --git a/app/Contracts/Locations/UpdatesLocations.php b/app/Contracts/Locations/UpdatesLocations.php index a2238119b..527525302 100644 --- a/app/Contracts/Locations/UpdatesLocations.php +++ b/app/Contracts/Locations/UpdatesLocations.php @@ -9,8 +9,8 @@ use Pterodactyl\Models\Location; interface UpdatesLocations { /** - * Update an existing location. The input is validated here, so it can come straight from any caller; - * extension field values go under `extensions` as ValidatedExtensionValues. + * The input is validated here. Extension field values go under `extensions` as + * ValidatedExtensionValues. * * @param array $input short and long */ diff --git a/app/Contracts/Mounts/AttachesEggsToMounts.php b/app/Contracts/Mounts/AttachesEggsToMounts.php index 9259d04cd..4db8886bf 100644 --- a/app/Contracts/Mounts/AttachesEggsToMounts.php +++ b/app/Contracts/Mounts/AttachesEggsToMounts.php @@ -9,8 +9,8 @@ use Pterodactyl\Models\Mount; interface AttachesEggsToMounts { /** - * Attach eggs to a mount, keeping any eggs already attached. The ids are validated here, - * so they can come straight from any caller; errors are reported under `eggs` and `eggs.N`. + * Eggs already attached stay attached. The ids are validated here; errors are reported under + * `eggs` and `eggs.N`. * * @param list $eggIds ids of existing eggs, as integers or numeric strings */ diff --git a/app/Contracts/Mounts/AttachesNodesToMounts.php b/app/Contracts/Mounts/AttachesNodesToMounts.php index d94007a68..a79bf5bbb 100644 --- a/app/Contracts/Mounts/AttachesNodesToMounts.php +++ b/app/Contracts/Mounts/AttachesNodesToMounts.php @@ -9,8 +9,8 @@ use Pterodactyl\Models\Mount; interface AttachesNodesToMounts { /** - * Attach nodes to a mount, keeping any nodes already attached. The ids are validated here, - * so they can come straight from any caller; errors are reported under `nodes` and `nodes.N`. + * Nodes already attached stay attached. The ids are validated here; errors are reported + * under `nodes` and `nodes.N`. * * @param list $nodeIds ids of existing nodes, as integers or numeric strings */ diff --git a/app/Contracts/Mounts/CreatesMounts.php b/app/Contracts/Mounts/CreatesMounts.php index 70a736329..30ef5996e 100644 --- a/app/Contracts/Mounts/CreatesMounts.php +++ b/app/Contracts/Mounts/CreatesMounts.php @@ -9,9 +9,8 @@ use Pterodactyl\Models\Mount; interface CreatesMounts { /** - * Create a new mount, assigning it a fresh UUID. The input is validated here, so it can - * come straight from any caller; extension field values go under `extensions` as - * ValidatedExtensionValues. + * The mount gets a fresh UUID. The input is validated here. Extension field values go under + * `extensions` as ValidatedExtensionValues. * * @param array $input name, source and target, and optionally description, read_only and user_mountable */ diff --git a/app/Contracts/Mounts/DeletesMounts.php b/app/Contracts/Mounts/DeletesMounts.php index 2cb4cb4ef..fc7805d68 100644 --- a/app/Contracts/Mounts/DeletesMounts.php +++ b/app/Contracts/Mounts/DeletesMounts.php @@ -8,8 +8,5 @@ use Pterodactyl\Models\Mount; interface DeletesMounts { - /** - * Delete a mount. - */ public function delete(Mount $mount): void; } diff --git a/app/Contracts/Mounts/DetachesEggsFromMounts.php b/app/Contracts/Mounts/DetachesEggsFromMounts.php index f94f0e87c..ec9341cf6 100644 --- a/app/Contracts/Mounts/DetachesEggsFromMounts.php +++ b/app/Contracts/Mounts/DetachesEggsFromMounts.php @@ -9,8 +9,5 @@ use Pterodactyl\Models\Mount; interface DetachesEggsFromMounts { - /** - * Remove a single egg attachment from a mount. - */ public function detach(Mount $mount, Egg $egg): void; } diff --git a/app/Contracts/Mounts/DetachesNodesFromMounts.php b/app/Contracts/Mounts/DetachesNodesFromMounts.php index 3c04581b5..da28b28fd 100644 --- a/app/Contracts/Mounts/DetachesNodesFromMounts.php +++ b/app/Contracts/Mounts/DetachesNodesFromMounts.php @@ -9,8 +9,5 @@ use Pterodactyl\Models\Node; interface DetachesNodesFromMounts { - /** - * Remove a single node attachment from a mount. - */ public function detach(Mount $mount, Node $node): void; } diff --git a/app/Contracts/Mounts/UpdatesMounts.php b/app/Contracts/Mounts/UpdatesMounts.php index 172385ce5..eb8c1adcb 100644 --- a/app/Contracts/Mounts/UpdatesMounts.php +++ b/app/Contracts/Mounts/UpdatesMounts.php @@ -9,10 +9,9 @@ use Pterodactyl\Models\Mount; interface UpdatesMounts { /** - * Update an existing mount. The input is validated here, so it can come straight from any - * caller. It takes the fields a mount is created with, required ones included; the - * description and flags keep their stored values when they are left out. Extension field - * values go under `extensions` as ValidatedExtensionValues. + * The input is validated here and takes the fields a mount is created with, required ones + * included; the description and flags keep their stored values when they are left out. + * Extension field values go under `extensions` as ValidatedExtensionValues. * * @param array $input the fields a mount is created with */ diff --git a/app/Contracts/Nodes/CreatesNodes.php b/app/Contracts/Nodes/CreatesNodes.php index 52b1d6ecc..d52a1dd6a 100644 --- a/app/Contracts/Nodes/CreatesNodes.php +++ b/app/Contracts/Nodes/CreatesNodes.php @@ -9,10 +9,9 @@ use Pterodactyl\Models\Node; interface CreatesNodes { /** - * Create a node and mint its daemon token pair. The input is validated here, so it can - * come straight from any caller; extension field values go under `extensions` as - * ValidatedExtensionValues. A node given no daemon_base keeps its files in - * /var/lib/pterodactyl/volumes. + * The node gets a fresh daemon token pair. The input is validated here, and a node given no + * daemon_base keeps its files in /var/lib/pterodactyl/volumes. Extension field values go + * under `extensions` as ValidatedExtensionValues. * * @param array $input name, location_id, fqdn, scheme, memory, memory_overallocate, disk, disk_overallocate, daemon_listen and daemon_sftp, and optionally public, description, behind_proxy, maintenance_mode, upload_size and daemon_base */ diff --git a/app/Contracts/Nodes/DeletesNodes.php b/app/Contracts/Nodes/DeletesNodes.php index 54dee3dd0..ba6afd938 100644 --- a/app/Contracts/Nodes/DeletesNodes.php +++ b/app/Contracts/Nodes/DeletesNodes.php @@ -10,7 +10,7 @@ use Pterodactyl\Models\Node; interface DeletesNodes { /** - * Delete a node from the panel if no servers are attached to it. + * A node with servers on it is not deleted. * * @throws HasActiveServersException */ diff --git a/app/Contracts/Nodes/UpdatesNodes.php b/app/Contracts/Nodes/UpdatesNodes.php index 4166b232c..4d884af98 100644 --- a/app/Contracts/Nodes/UpdatesNodes.php +++ b/app/Contracts/Nodes/UpdatesNodes.php @@ -4,23 +4,23 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Nodes; +use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException; use Pterodactyl\Models\Node; use Throwable; interface UpdatesNodes { /** - * Update the configuration values for a given node on the machine, minting a new daemon - * token pair when $resetToken is set. - * - * The input is validated here, so it can come straight from any caller. It takes the - * fields a node is created with, required ones included; a node given no daemon_base goes - * back to /var/lib/pterodactyl/volumes, and the other optional fields keep their stored - * values when they are left out. Extension field values go under `extensions` as - * ValidatedExtensionValues. + * A new daemon token pair is minted when $resetToken is set. The input is validated here and + * takes the fields a node is created with, required ones included; a node given no + * daemon_base goes back to /var/lib/pterodactyl/volumes, and the other optional fields keep + * their stored values when they are left out. Extension field values go under `extensions` + * as ValidatedExtensionValues. When Wings cannot be reached the change is still saved and + * ConfigurationNotPersistedException is thrown. * * @param array $input the fields a node is created with * + * @throws ConfigurationNotPersistedException * @throws Throwable */ public function update(Node $node, array $input, bool $resetToken = false): Node; diff --git a/app/Contracts/Schedules/CreatesScheduleTasks.php b/app/Contracts/Schedules/CreatesScheduleTasks.php index cef2fed42..407ac7319 100644 --- a/app/Contracts/Schedules/CreatesScheduleTasks.php +++ b/app/Contracts/Schedules/CreatesScheduleTasks.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Schedules; +use Pterodactyl\Exceptions\Http\HttpForbiddenException; use Pterodactyl\Exceptions\Service\ServiceLimitExceededException; use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Task; @@ -12,13 +13,13 @@ use Throwable; interface CreatesScheduleTasks { /** - * Appends a task to the schedule, or slots it into the requested position by - * shifting the tasks that follow it. - * - * Validates the input itself, so it can come straight from any caller. + * Append the task to the schedule, or slot it into the requested position by shifting the + * tasks that follow it. The input is validated here, and a backup task is refused while the + * server cannot hold any backups. * * @param array $input action, payload, time_offset, and optionally sequence_id and continue_on_failure * + * @throws HttpForbiddenException * @throws ServiceLimitExceededException * @throws Throwable */ diff --git a/app/Contracts/Schedules/CreatesSchedules.php b/app/Contracts/Schedules/CreatesSchedules.php index 4080101e5..e70cee145 100644 --- a/app/Contracts/Schedules/CreatesSchedules.php +++ b/app/Contracts/Schedules/CreatesSchedules.php @@ -11,7 +11,8 @@ use Pterodactyl\Models\Server; interface CreatesSchedules { /** - * Validates the input itself, so it can come straight from any caller. + * The input is validated here, and cron fields that do not form a valid expression are + * refused. * * @param array $input name, is_active, minute, hour, day_of_month, month, day_of_week and only_when_online * diff --git a/app/Contracts/Schedules/DeletesScheduleTasks.php b/app/Contracts/Schedules/DeletesScheduleTasks.php index ab0e23bb8..96c9a9217 100644 --- a/app/Contracts/Schedules/DeletesScheduleTasks.php +++ b/app/Contracts/Schedules/DeletesScheduleTasks.php @@ -11,7 +11,7 @@ use Throwable; interface DeletesScheduleTasks { /** - * Deletes the task and closes the gap it leaves in the schedule's sequence. + * The gap the task leaves in the schedule's sequence is closed. * * @throws Throwable */ diff --git a/app/Contracts/Schedules/ProcessesSchedules.php b/app/Contracts/Schedules/ProcessesSchedules.php index 12b30ee93..71659b417 100644 --- a/app/Contracts/Schedules/ProcessesSchedules.php +++ b/app/Contracts/Schedules/ProcessesSchedules.php @@ -10,7 +10,7 @@ use Throwable; interface ProcessesSchedules { /** - * Process a schedule and push the first task onto the queue worker. + * Push the schedule's first task onto the queue worker. * * @throws Throwable */ diff --git a/app/Contracts/Schedules/UpdatesScheduleTasks.php b/app/Contracts/Schedules/UpdatesScheduleTasks.php index a3ed1d121..127254af8 100644 --- a/app/Contracts/Schedules/UpdatesScheduleTasks.php +++ b/app/Contracts/Schedules/UpdatesScheduleTasks.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Schedules; +use Pterodactyl\Exceptions\Http\HttpForbiddenException; use Pterodactyl\Models\Schedule; use Pterodactyl\Models\Task; use Throwable; @@ -11,13 +12,13 @@ use Throwable; interface UpdatesScheduleTasks { /** - * Updates the task and, when its position changes, shifts the tasks between the - * old and new positions to keep the sequence contiguous. - * - * Validates the input itself, so it can come straight from any caller. + * When the task's position changes, the tasks between its old and new positions shift to + * keep the sequence contiguous. The input is validated here, and a backup task is refused + * while the server cannot hold any backups. * * @param array $input action, payload, time_offset, and optionally sequence_id and continue_on_failure * + * @throws HttpForbiddenException * @throws Throwable */ public function update(Schedule $schedule, Task $task, array $input): Task; diff --git a/app/Contracts/Schedules/UpdatesSchedules.php b/app/Contracts/Schedules/UpdatesSchedules.php index 27c962c0d..4f398b6c6 100644 --- a/app/Contracts/Schedules/UpdatesSchedules.php +++ b/app/Contracts/Schedules/UpdatesSchedules.php @@ -10,7 +10,8 @@ use Pterodactyl\Models\Schedule; interface UpdatesSchedules { /** - * Validates the input itself, so it can come straight from any caller. + * The input is validated here, and cron fields that do not form a valid expression are + * refused. * * @param array $input the same fields a schedule is created with * diff --git a/app/Contracts/Servers/CreatesServers.php b/app/Contracts/Servers/CreatesServers.php index 650a060ac..d5c3f088d 100644 --- a/app/Contracts/Servers/CreatesServers.php +++ b/app/Contracts/Servers/CreatesServers.php @@ -15,11 +15,11 @@ use Throwable; interface CreatesServers { /** - * Create a server and ask Wings to install it, deleting it again when Wings cannot be - * reached. The input is validated here, so it can come straight from any caller; extension - * field values go under `extensions` as ValidatedExtensionValues, and the environment is - * checked against the egg's variable rules. Without a deployment the server takes the - * allocation_id given; with one, the deployment picks its node and default allocation. + * Wings is asked to install the server, which is deleted again when Wings cannot be reached. + * The input is validated here; extension field values go under `extensions` as + * ValidatedExtensionValues, and the environment is checked against the egg's variable rules. + * Without a deployment the server takes the allocation_id given; with one, the deployment + * picks its node and default allocation. * * @param array $input name, owner_id, egg_id, image, startup, memory, swap, disk, io, cpu and, without a deployment, allocation_id, and optionally external_id, description, environment, skip_scripts, oom_disabled, threads, database_limit, allocation_limit, backup_limit, allocation_additional and start_on_completion * diff --git a/app/Contracts/Servers/ReinstallsServers.php b/app/Contracts/Servers/ReinstallsServers.php index 8b8102280..8d721745d 100644 --- a/app/Contracts/Servers/ReinstallsServers.php +++ b/app/Contracts/Servers/ReinstallsServers.php @@ -4,11 +4,15 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Servers; +use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Models\Server; use Throwable; interface ReinstallsServers { - /** @throws Throwable */ + /** + * @throws DisplayException when the server skips its install script and is installed + * @throws Throwable + */ public function reinstall(Server $server): Server; } diff --git a/app/Contracts/Servers/TogglesServerSuspension.php b/app/Contracts/Servers/TogglesServerSuspension.php index 4452b2643..1c0cc3dc6 100644 --- a/app/Contracts/Servers/TogglesServerSuspension.php +++ b/app/Contracts/Servers/TogglesServerSuspension.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Pterodactyl\Contracts\Servers; use Pterodactyl\Models\Server; +use Throwable; interface TogglesServerSuspension { @@ -12,5 +13,6 @@ interface TogglesServerSuspension public const string ACTION_UNSUSPEND = 'unsuspend'; + /** @throws Throwable */ public function toggle(Server $server, string $action = self::ACTION_SUSPEND): void; } diff --git a/app/Contracts/Servers/UpdatesServerBuild.php b/app/Contracts/Servers/UpdatesServerBuild.php index b79d32529..1677bb5b7 100644 --- a/app/Contracts/Servers/UpdatesServerBuild.php +++ b/app/Contracts/Servers/UpdatesServerBuild.php @@ -11,11 +11,11 @@ use Throwable; interface UpdatesServerBuild { /** - * Update a server's build and sync it to Wings. The input is validated here, so it can - * come straight from any caller. Only the fields given are changed, except the feature - * limits: a database or allocation limit left out is cleared, and a backup limit left - * out becomes 0. Allocations to add are assigned only when they are free and on the - * server's node; removing the default allocation needs a newly added one to replace it. + * The build is synced to Wings. The input is validated here, and only the fields given are + * changed, except the feature limits: a database or allocation limit left out is cleared, + * and a backup limit left out becomes 0. Allocations to add are assigned only when they are + * free and on the server's node; removing the default allocation needs a newly added one to + * replace it. * * @param array $input any of allocation_id, oom_disabled, memory, swap, io, cpu, threads, disk, add_allocations, remove_allocations, database_limit, allocation_limit and backup_limit * diff --git a/app/Contracts/Servers/UpdatesServerDetails.php b/app/Contracts/Servers/UpdatesServerDetails.php index 3fb4cd2f4..fd682d979 100644 --- a/app/Contracts/Servers/UpdatesServerDetails.php +++ b/app/Contracts/Servers/UpdatesServerDetails.php @@ -10,10 +10,9 @@ use Throwable; interface UpdatesServerDetails { /** - * Update a server's details. The input is validated here, so it can come straight from - * any caller. Every detail is replaced: an external id left out is cleared and a - * description left out becomes empty. A new owner takes the server's SFTP access from - * the previous one. Extension field values go under `extensions` as + * The input is validated here, and every detail is replaced: an external id left out is + * cleared and a description left out becomes empty. A new owner takes the server's SFTP + * access from the previous one. Extension field values go under `extensions` as * ValidatedExtensionValues. * * @param array $input name and owner_id, and optionally external_id and description diff --git a/app/Contracts/Servers/UpdatesServerStartup.php b/app/Contracts/Servers/UpdatesServerStartup.php index 59c4d6d40..4e551308a 100644 --- a/app/Contracts/Servers/UpdatesServerStartup.php +++ b/app/Contracts/Servers/UpdatesServerStartup.php @@ -11,12 +11,10 @@ use Throwable; interface UpdatesServerStartup { /** - * Update a server's startup at the given user level. The input is validated here, so it - * can come straight from any caller; only the fields given are validated. The - * environment is checked against the egg's variable rules, and below the admin level - * only the variables a user may edit are written. Only an administrator changes the - * startup command, egg, Docker image and install script flag; at the admin level an - * install script flag left out turns it off. + * Only the fields given are validated here and changed. The environment is checked against + * the egg's variable rules, and below the admin level only the variables a user may edit are + * written. Only an administrator changes the startup command, egg, Docker image and install + * script flag; at the admin level an install script flag left out turns it off. * * @param array $input any of environment and, at the admin level, startup, egg_id, docker_image and skip_scripts * diff --git a/app/Contracts/Subusers/CreatesSubusers.php b/app/Contracts/Subusers/CreatesSubusers.php index 13d73ce1a..93c726aba 100644 --- a/app/Contracts/Subusers/CreatesSubusers.php +++ b/app/Contracts/Subusers/CreatesSubusers.php @@ -13,13 +13,11 @@ use Throwable; interface CreatesSubusers { /** - * Creates a new user on the system and assigns them access to the provided server. - * If the email address already belongs to a user on the system a new user will not - * be created. - * - * The email address and the permissions are validated here, so they can come straight - * from any caller: each permission must be one the panel or an enabled extension - * defines. Whether the caller may grant them is left to the caller. + * Give the user with the email address access to the server, inviting a new user when no + * account has it; the returned subuser's user reports wasRecentlyCreated when one was. The + * email address and the permissions are validated here: each permission must be one the + * panel or an enabled extension defines. Whether the caller may grant them is left to the + * caller. * * @param list $permissions The permission keys to grant, deduplicated * before they are stored. diff --git a/app/Contracts/Subusers/DeletesSubusers.php b/app/Contracts/Subusers/DeletesSubusers.php index f1ec01f33..9cb9ac192 100644 --- a/app/Contracts/Subusers/DeletesSubusers.php +++ b/app/Contracts/Subusers/DeletesSubusers.php @@ -11,7 +11,7 @@ use Throwable; interface DeletesSubusers { /** - * Removes the subuser from the server and revokes their outstanding SFTP sessions on Wings. + * The subuser's outstanding SFTP sessions on Wings are revoked. * * @throws Throwable */ diff --git a/app/Contracts/Subusers/UpdatesSubusers.php b/app/Contracts/Subusers/UpdatesSubusers.php index 1594b74fe..a7ee95b50 100644 --- a/app/Contracts/Subusers/UpdatesSubusers.php +++ b/app/Contracts/Subusers/UpdatesSubusers.php @@ -11,11 +11,10 @@ use Throwable; interface UpdatesSubusers { /** - * Replaces the subuser's permissions and revokes their outstanding SFTP sessions on Wings. - * - * The permissions are validated here, so they can come straight from any caller: each - * must be one the panel or an enabled extension defines, or one the subuser already - * holds. Whether the caller may grant them is left to the caller. + * Replaces the subuser's permissions and revokes their outstanding SFTP sessions on Wings; + * permissions the subuser already has, in any order, change nothing. The permissions are + * validated here: each must be one the panel or an enabled extension defines, or one the + * subuser already holds. Whether the caller may grant them is left to the caller. * * @param list $permissions * diff --git a/app/Contracts/Tags/CreatesTags.php b/app/Contracts/Tags/CreatesTags.php index 739bb8418..1da0a0dfa 100644 --- a/app/Contracts/Tags/CreatesTags.php +++ b/app/Contracts/Tags/CreatesTags.php @@ -9,7 +9,7 @@ use Pterodactyl\Models\Tag; interface CreatesTags { /** - * Create a new tag. The input is validated here, so it can come straight from any caller. + * The input is validated here. * * @param array $input name and slug, and optionally color and legacy_nest_id */ diff --git a/app/Contracts/Tags/DeletesTags.php b/app/Contracts/Tags/DeletesTags.php index 0d86dc03d..1bf0618f8 100644 --- a/app/Contracts/Tags/DeletesTags.php +++ b/app/Contracts/Tags/DeletesTags.php @@ -10,7 +10,7 @@ use Pterodactyl\Models\Tag; interface DeletesTags { /** - * Delete a tag and detach it from every egg and node. Built-in game tags cannot be deleted. + * The tag is detached from every egg and node. Built-in game tags cannot be deleted. * * @throws DisplayException */ diff --git a/app/Contracts/Tags/SyncsTags.php b/app/Contracts/Tags/SyncsTags.php index 896331490..69598b084 100644 --- a/app/Contracts/Tags/SyncsTags.php +++ b/app/Contracts/Tags/SyncsTags.php @@ -10,8 +10,7 @@ use Pterodactyl\Models\Node; /** * Replaces the full set of tags of one kind on an egg or a node. Each value is an existing * tag's id, as an integer or a numeric string, or the name of a tag to find or create. The - * values are validated here, so they can come straight from any caller; errors are reported - * under `tags` and `tags.N`. + * values are validated here; errors are reported under `tags` and `tags.N`. */ interface SyncsTags { diff --git a/app/Contracts/Tags/UpdatesTags.php b/app/Contracts/Tags/UpdatesTags.php index 1ab3ce75a..177e63b3b 100644 --- a/app/Contracts/Tags/UpdatesTags.php +++ b/app/Contracts/Tags/UpdatesTags.php @@ -10,10 +10,9 @@ use Pterodactyl\Models\Tag; interface UpdatesTags { /** - * Update an existing tag. Built-in game tags cannot be edited. The input is validated here, - * so it can come straight from any caller. It takes the fields a tag is created with, - * required ones included; the colour and legacy nest id keep their stored values when they - * are left out. + * Built-in game tags cannot be edited. The input is validated here and takes the fields a + * tag is created with, required ones included; the colour and legacy nest id keep their + * stored values when they are left out. * * @param array $input the fields a tag is created with * diff --git a/app/Contracts/Themes/AppliesThemes.php b/app/Contracts/Themes/AppliesThemes.php index 72f331dc4..f5250bb8e 100644 --- a/app/Contracts/Themes/AppliesThemes.php +++ b/app/Contracts/Themes/AppliesThemes.php @@ -6,5 +6,6 @@ namespace Pterodactyl\Contracts\Themes; interface AppliesThemes { + /** Publish the theme's tokens.css, and its assets/ directory when it has one. */ public function apply(string $id): void; } diff --git a/app/Contracts/Themes/ResetsThemes.php b/app/Contracts/Themes/ResetsThemes.php index 10366713e..cb51db2eb 100644 --- a/app/Contracts/Themes/ResetsThemes.php +++ b/app/Contracts/Themes/ResetsThemes.php @@ -6,5 +6,6 @@ namespace Pterodactyl\Contracts\Themes; interface ResetsThemes { + /** Remove the published theme, restoring the stock look. */ public function reset(): void; } diff --git a/app/Contracts/Transfers/InitiatesTransfers.php b/app/Contracts/Transfers/InitiatesTransfers.php index d54f20270..46e525bc2 100644 --- a/app/Contracts/Transfers/InitiatesTransfers.php +++ b/app/Contracts/Transfers/InitiatesTransfers.php @@ -14,13 +14,14 @@ use Throwable; interface InitiatesTransfers { /** - * Records the transfer, reserves the target allocations, and tells the destination - * node to begin pulling the server. + * Records the transfer, reserves the target allocations, and tells the destination node to + * begin pulling the server once the records are committed; a transfer Wings rejects is + * marked failed and its allocations are released. * - * The node and allocations are validated here, so they can come straight from any - * caller: the node must not be the server's own, the default allocation must be no - * server's default, and every allocation must exist, be unassigned and be on the node. - * Errors are reported under node_id, allocation_id and allocation_additional.N. + * The node and allocations are validated here: the node must not be the server's own, the + * default allocation must be no server's default, and every allocation must exist, be + * unassigned and be on the node. Errors are reported under node_id, allocation_id and + * allocation_additional.N. * * @param list $additionalAllocations * diff --git a/app/Contracts/Users/CreatesSshKeys.php b/app/Contracts/Users/CreatesSshKeys.php index 9204f9a77..bcd3b12f5 100644 --- a/app/Contracts/Users/CreatesSshKeys.php +++ b/app/Contracts/Users/CreatesSshKeys.php @@ -11,10 +11,8 @@ use Pterodactyl\Models\UserSSHKey; interface CreatesSshKeys { /** - * Add an SSH public key to a user's account for SFTP. The key is not parsed here, so - * pass one that is already validated along with its fingerprint. The name, key and - * fingerprint are validated here, so they can come straight from any caller: none may - * be blank. + * The key is not parsed here, so pass one that is already validated along with its + * fingerprint. The name, key and fingerprint are validated here: none may be blank. * * @throws ValidationException */ diff --git a/app/Contracts/Users/CreatesUsers.php b/app/Contracts/Users/CreatesUsers.php index 9d70fe339..5b5ddef0a 100644 --- a/app/Contracts/Users/CreatesUsers.php +++ b/app/Contracts/Users/CreatesUsers.php @@ -10,14 +10,9 @@ use Throwable; interface CreatesUsers { /** - * Create a new user on the system. When no password is provided a random one is - * set and a password reset token is generated for the account welcome email. - * - * The UUID and password hash are handled by the model itself (HasVersion4Uuids - * and the hashed password cast). - * - * The input is validated here, so it can come straight from any caller; extension - * field values go under `extensions` as ValidatedExtensionValues. + * A user given no password gets a random one and a password reset token for the welcome + * email. Pass a password in plain text; the model hashes it. The input is validated here. + * Extension field values go under `extensions` as ValidatedExtensionValues. * * @param array $input email, username, name_first, name_last, and optionally external_id, password, root_admin and language * diff --git a/app/Contracts/Users/DeletesUsers.php b/app/Contracts/Users/DeletesUsers.php index 64c064746..1dbc8ca73 100644 --- a/app/Contracts/Users/DeletesUsers.php +++ b/app/Contracts/Users/DeletesUsers.php @@ -10,7 +10,7 @@ use Pterodactyl\Models\User; interface DeletesUsers { /** - * Delete a user from the panel only if they have no servers attached to their account. + * A user who owns servers is not deleted. * * @throws DisplayException */ diff --git a/app/Contracts/Users/TogglesTwoFactor.php b/app/Contracts/Users/TogglesTwoFactor.php index b187fb533..4ce31f613 100644 --- a/app/Contracts/Users/TogglesTwoFactor.php +++ b/app/Contracts/Users/TogglesTwoFactor.php @@ -14,7 +14,7 @@ use Throwable; interface TogglesTwoFactor { /** - * Toggle 2FA on an account only if the token provided is valid. + * The token must be valid. * * @return list The plaintext recovery tokens generated for the account, * empty when 2FA is being turned off. diff --git a/app/Contracts/Users/UpdatesUserPasswords.php b/app/Contracts/Users/UpdatesUserPasswords.php index fd5bb2f37..eb8985b54 100644 --- a/app/Contracts/Users/UpdatesUserPasswords.php +++ b/app/Contracts/Users/UpdatesUserPasswords.php @@ -8,5 +8,6 @@ use Pterodactyl\Models\User; interface UpdatesUserPasswords { + /** Every other session and "remember me" login made with the old password is ended. */ public function update(User $user, string $password): User; } diff --git a/app/Contracts/Users/UpdatesUsers.php b/app/Contracts/Users/UpdatesUsers.php index be0f1d040..adc242f68 100644 --- a/app/Contracts/Users/UpdatesUsers.php +++ b/app/Contracts/Users/UpdatesUsers.php @@ -10,12 +10,9 @@ use Throwable; interface UpdatesUsers { /** - * Update the user model instance and return the updated model. The hashed - * password cast on the model takes care of hashing a new password. - * - * The input is validated here, so it can come straight from any caller. Only the fields - * given are changed; a blank password leaves the password alone. Extension field values - * go under `extensions` as ValidatedExtensionValues. + * Pass a new password in plain text; the model hashes it. The input is validated here, only + * the fields given are changed, and a blank password leaves the password alone. Extension + * field values go under `extensions` as ValidatedExtensionValues. * * @param array $input any of the fields a user is created with *