Upgrade to Laravel 9 (#4413)
Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
parent
95e15d2c8a
commit
cbcf62086f
573 changed files with 4387 additions and 9411 deletions
|
@ -1,24 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Criteria;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Pterodactyl\Repositories\Repository;
|
||||
|
||||
interface CriteriaInterface
|
||||
{
|
||||
/**
|
||||
* Apply selected criteria to a repository call.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Model $model
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function apply($model, Repository $repository);
|
||||
public function apply(Model $model, Repository $repository): mixed;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Extensions;
|
||||
|
||||
|
@ -16,12 +9,7 @@ interface HashidsInterface extends VendorHashidsInterface
|
|||
/**
|
||||
* Decode an encoded hashid and return the first result.
|
||||
*
|
||||
* @param string $encoded
|
||||
* @param null $default
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function decodeFirst($encoded, $default = null);
|
||||
public function decodeFirst(string $encoded, string $default = null): mixed;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ interface ClientPermissionsRequest
|
|||
{
|
||||
/**
|
||||
* Returns the permissions string indicating which permission should be used to
|
||||
* validate that the authenticated user has permission to perform this action aganist
|
||||
* validate that the authenticated user has permission to perform this action against
|
||||
* the given resource (server).
|
||||
*/
|
||||
public function permission(): string;
|
||||
|
|
|
@ -2,18 +2,18 @@
|
|||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Pterodactyl\Models\Allocation;
|
||||
|
||||
interface AllocationRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return all of the allocations that exist for a node that are not currently
|
||||
* Return all the allocations that exist for a node that are not currently
|
||||
* allocated.
|
||||
*/
|
||||
public function getUnassignedAllocationIds(int $node): array;
|
||||
|
||||
/**
|
||||
* Return a single allocation from those meeting the requirements.
|
||||
*
|
||||
* @return \Pterodactyl\Models\Allocation|null
|
||||
*/
|
||||
public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false);
|
||||
public function getRandomAllocation(array $nodes, array $ports, bool $dedicated = false): ?Allocation;
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@ use Illuminate\Support\Collection;
|
|||
interface ApiKeyRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Get all of the account API keys that exist for a specific user.
|
||||
* Get all the account API keys that exist for a specific user.
|
||||
*/
|
||||
public function getAccountKeys(User $user): Collection;
|
||||
|
||||
/**
|
||||
* Get all of the application API keys that exist for a specific user.
|
||||
* Get all the application API keys that exist for a specific user.
|
||||
*/
|
||||
public function getApplicationKeys(User $user): Collection;
|
||||
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Pterodactyl\Models\Database;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
|
||||
|
@ -12,10 +11,8 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Set the connection name to execute statements against.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setConnection(string $connection);
|
||||
public function setConnection(string $connection): self;
|
||||
|
||||
/**
|
||||
* Return the connection to execute statements against.
|
||||
|
@ -23,12 +20,12 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
|
|||
public function getConnection(): string;
|
||||
|
||||
/**
|
||||
* Return all of the databases belonging to a server.
|
||||
* Return all the databases belonging to a server.
|
||||
*/
|
||||
public function getDatabasesForServer(int $server): Collection;
|
||||
|
||||
/**
|
||||
* Return all of the databases for a given host with the server relationship loaded.
|
||||
* Return all the databases for a given host with the server relationship loaded.
|
||||
*/
|
||||
public function getDatabasesForHost(int $host, int $count = 25): LengthAwarePaginator;
|
||||
|
||||
|
@ -39,10 +36,8 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Create a new database user on a given connection.
|
||||
*
|
||||
* @param $max_connections
|
||||
*/
|
||||
public function createUser(string $username, string $remote, string $password, string $max_connections): bool;
|
||||
public function createUser(string $username, string $remote, string $password, ?int $max_connections): bool;
|
||||
|
||||
/**
|
||||
* Give a specific user access to a given database.
|
||||
|
@ -61,8 +56,6 @@ interface DatabaseRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Drop a given user on a specific connection.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function dropUser(string $username, string $remote): bool;
|
||||
}
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
|
@ -28,13 +21,11 @@ interface EggRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Return an egg with the scriptFrom and configFrom relations loaded onto the model.
|
||||
*
|
||||
* @param int|string $value
|
||||
*/
|
||||
public function getWithCopyAttributes($value, string $column = 'id'): Egg;
|
||||
public function getWithCopyAttributes(int|string $value, string $column = 'id'): Egg;
|
||||
|
||||
/**
|
||||
* Return all of the data needed to export a service.
|
||||
* Return all the data needed to export a service.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
|
|
|
@ -13,14 +13,12 @@ interface LocationRepositoryInterface extends RepositoryInterface
|
|||
public function getAllWithDetails(): Collection;
|
||||
|
||||
/**
|
||||
* Return all of the available locations with the nodes as a relationship.
|
||||
* Return all the available locations with the nodes as a relationship.
|
||||
*/
|
||||
public function getAllWithNodes(): Collection;
|
||||
|
||||
/**
|
||||
* Return all of the nodes and their respective count of servers for a location.
|
||||
*
|
||||
* @return mixed
|
||||
* Return all the nodes and their respective count of servers for a location.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
@ -29,8 +27,6 @@ interface LocationRepositoryInterface extends RepositoryInterface
|
|||
/**
|
||||
* Return a location and the count of nodes in that location.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function getWithNodeCount(int $id): Location;
|
||||
|
|
|
@ -1,37 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Pterodactyl\Models\Nest;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
interface NestRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return a nest or all nests with their associated eggs and variables.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Collection|\Pterodactyl\Models\Nest
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function getWithEggs(int $id = null);
|
||||
public function getWithEggs(int $id = null): Collection|Nest;
|
||||
|
||||
/**
|
||||
* Return a nest or all nests and the count of eggs and servers for that nest.
|
||||
*
|
||||
* @return \Pterodactyl\Models\Nest|\Illuminate\Database\Eloquent\Collection
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function getWithCounts(int $id = null);
|
||||
public function getWithCounts(int $id = null): Collection|Nest;
|
||||
|
||||
/**
|
||||
* Return a nest along with its associated eggs and the servers relation on those eggs.
|
||||
|
|
|
@ -1,11 +1,4 @@
|
|||
<?php
|
||||
/**
|
||||
* Pterodactyl - Panel
|
||||
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
|
||||
*
|
||||
* This software is licensed under the terms of the MIT license.
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
|
||||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
|
|
|
@ -3,87 +3,67 @@
|
|||
namespace Pterodactyl\Contracts\Repository;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||
|
||||
interface RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return an identifier or Model object to be used by the repository.
|
||||
*
|
||||
* @return string|\Closure|object
|
||||
*/
|
||||
public function model();
|
||||
public function model(): string;
|
||||
|
||||
/**
|
||||
* Return the model being used for this repository instance.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getModel();
|
||||
public function getModel(): Model;
|
||||
|
||||
/**
|
||||
* Returns an instance of a query builder.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBuilder();
|
||||
public function getBuilder(): Builder;
|
||||
|
||||
/**
|
||||
* Returns the columns to be selected or returned by the query.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getColumns();
|
||||
public function getColumns(): array;
|
||||
|
||||
/**
|
||||
* An array of columns to filter the response by.
|
||||
*
|
||||
* @param array|string $columns
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setColumns($columns = ['*']);
|
||||
public function setColumns(array|string $columns = ['*']): self;
|
||||
|
||||
/**
|
||||
* Stop repository update functions from returning a fresh
|
||||
* model when changes are committed.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withoutFreshModel();
|
||||
public function withoutFreshModel(): self;
|
||||
|
||||
/**
|
||||
* Return a fresh model with a repository updates a model.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function withFreshModel();
|
||||
public function withFreshModel(): self;
|
||||
|
||||
/**
|
||||
* Set whether or not the repository should return a fresh model
|
||||
* Set whether the repository should return a fresh model
|
||||
* when changes are committed.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFreshModel(bool $fresh = true);
|
||||
public function setFreshModel(bool $fresh = true): self;
|
||||
|
||||
/**
|
||||
* Create a new model instance and persist it to the database.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function create(array $fields, bool $validate = true, bool $force = false);
|
||||
public function create(array $fields, bool $validate = true, bool $force = false): mixed;
|
||||
|
||||
/**
|
||||
* Find a model that has the specific ID passed.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function find(int $id);
|
||||
public function find(int $id): mixed;
|
||||
|
||||
/**
|
||||
* Find a model matching an array of where clauses.
|
||||
|
@ -93,11 +73,9 @@ interface RepositoryInterface
|
|||
/**
|
||||
* Find and return the first matching instance for the given fields.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function findFirstWhere(array $fields);
|
||||
public function findFirstWhere(array $fields): mixed;
|
||||
|
||||
/**
|
||||
* Return a count of records matching the passed arguments.
|
||||
|
@ -117,14 +95,10 @@ interface RepositoryInterface
|
|||
/**
|
||||
* Update a given ID with the passed array of fields.
|
||||
*
|
||||
* @param int $id
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
public function update($id, array $fields, bool $validate = true, bool $force = false);
|
||||
public function update(int $id, array $fields, bool $validate = true, bool $force = false): mixed;
|
||||
|
||||
/**
|
||||
* Perform a mass update where matching records are updated using whereIn.
|
||||
|
@ -135,11 +109,9 @@ interface RepositoryInterface
|
|||
/**
|
||||
* Update a record if it exists in the database, otherwise create it.
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
||||
*/
|
||||
public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false);
|
||||
public function updateOrCreate(array $where, array $fields, bool $validate = true, bool $force = false): mixed;
|
||||
|
||||
/**
|
||||
* Return all records associated with the given model.
|
||||
|
|
|
@ -8,12 +8,12 @@ use Illuminate\Support\Collection;
|
|||
interface ScheduleRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return all of the schedules for a given server.
|
||||
* Return all the schedules for a given server.
|
||||
*/
|
||||
public function findServerSchedules(int $server): Collection;
|
||||
|
||||
/**
|
||||
* Return a schedule model with all of the associated tasks as a relationship.
|
||||
* Return a schedule model with all the associated tasks as a relationship.
|
||||
*
|
||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||
*/
|
||||
|
|
|
@ -67,7 +67,7 @@ interface ServerRepositoryInterface extends RepositoryInterface
|
|||
public function isUniqueUuidCombo(string $uuid, string $short): bool;
|
||||
|
||||
/**
|
||||
* Returns all of the servers that exist for a given node in a paginated response.
|
||||
* Returns all the servers that exist for a given node in a paginated response.
|
||||
*/
|
||||
public function loadAllServersForNode(int $node, int $limit): LengthAwarePaginator;
|
||||
}
|
||||
|
|
|
@ -7,14 +7,12 @@ use Illuminate\Support\Collection;
|
|||
interface SessionRepositoryInterface extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Return all of the active sessions for a user.
|
||||
* Return all the active sessions for a user.
|
||||
*/
|
||||
public function getUserSessions(int $user): Collection;
|
||||
|
||||
/**
|
||||
* Delete a session for a given user.
|
||||
*
|
||||
* @return int|null
|
||||
*/
|
||||
public function deleteUserSession(int $user, string $session);
|
||||
public function deleteUserSession(int $user, string $session): ?int;
|
||||
}
|
||||
|
|
|
@ -14,12 +14,8 @@ interface SettingsRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Retrieve a persistent setting from the database.
|
||||
*
|
||||
* @param mixed $default
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get(string $key, $default);
|
||||
public function get(string $key, mixed $default): mixed;
|
||||
|
||||
/**
|
||||
* Remove a key from the database cache.
|
||||
|
|
|
@ -15,8 +15,6 @@ interface TaskRepositoryInterface extends RepositoryInterface
|
|||
|
||||
/**
|
||||
* Returns the next task in a schedule.
|
||||
*
|
||||
* @return \Pterodactyl\Models\Task|null
|
||||
*/
|
||||
public function getNextTask(int $schedule, int $index);
|
||||
public function getNextTask(int $schedule, int $index): ?Task;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue