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
|
@ -25,49 +25,20 @@ class DatabaseManagementService
|
|||
*/
|
||||
private const MATCH_NAME_REGEX = '/^(s[\d]+_)(.*)$/';
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Extensions\DynamicDatabaseConnection
|
||||
*/
|
||||
private $dynamic;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Encryption\Encrypter
|
||||
*/
|
||||
private $encrypter;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Repositories\Eloquent\DatabaseRepository
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* Determines if the service should validate the user's ability to create an additional
|
||||
* database for this server. In almost all cases this should be true, but to keep things
|
||||
* flexible you can also set it to false and create more databases than the server is
|
||||
* allocated.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
protected $validateDatabaseLimit = true;
|
||||
protected bool $validateDatabaseLimit = true;
|
||||
|
||||
/**
|
||||
* CreationService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
DynamicDatabaseConnection $dynamic,
|
||||
DatabaseRepository $repository,
|
||||
Encrypter $encrypter
|
||||
protected ConnectionInterface $connection,
|
||||
protected DynamicDatabaseConnection $dynamic,
|
||||
protected Encrypter $encrypter,
|
||||
protected DatabaseRepository $repository
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->dynamic = $dynamic;
|
||||
$this->encrypter = $encrypter;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,10 +53,8 @@ class DatabaseManagementService
|
|||
}
|
||||
|
||||
/**
|
||||
* Set wether or not this class should validate that the server has enough slots
|
||||
* Set whether this class should validate that the server has enough slots
|
||||
* left before creating the new database.
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setValidateDatabaseLimit(bool $validate): self
|
||||
{
|
||||
|
@ -97,13 +66,11 @@ class DatabaseManagementService
|
|||
/**
|
||||
* Create a new database that is linked to a specific host.
|
||||
*
|
||||
* @return \Pterodactyl\Models\Database
|
||||
*
|
||||
* @throws \Throwable
|
||||
* @throws \Pterodactyl\Exceptions\Service\Database\TooManyDatabasesException
|
||||
* @throws \Pterodactyl\Exceptions\Service\Database\DatabaseClientFeatureNotEnabledException
|
||||
*/
|
||||
public function create(Server $server, array $data)
|
||||
public function create(Server $server, array $data): Database
|
||||
{
|
||||
if (!config('pterodactyl.client_features.databases.enabled')) {
|
||||
throw new DatabaseClientFeatureNotEnabledException();
|
||||
|
@ -169,11 +136,9 @@ class DatabaseManagementService
|
|||
/**
|
||||
* Delete a database from the given host server.
|
||||
*
|
||||
* @return bool|null
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function delete(Database $database)
|
||||
public function delete(Database $database): ?bool
|
||||
{
|
||||
$this->dynamic->set('dynamic', $database->database_host_id);
|
||||
|
||||
|
|
|
@ -11,49 +11,23 @@ use Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface;
|
|||
|
||||
class DatabasePasswordService
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Extensions\DynamicDatabaseConnection
|
||||
*/
|
||||
private $dynamic;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Encryption\Encrypter
|
||||
*/
|
||||
private $encrypter;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* DatabasePasswordService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
DatabaseRepositoryInterface $repository,
|
||||
DynamicDatabaseConnection $dynamic,
|
||||
Encrypter $encrypter
|
||||
private ConnectionInterface $connection,
|
||||
private DynamicDatabaseConnection $dynamic,
|
||||
private Encrypter $encrypter,
|
||||
private DatabaseRepositoryInterface $repository
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->dynamic = $dynamic;
|
||||
$this->encrypter = $encrypter;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a password for a given database.
|
||||
*
|
||||
* @param \Pterodactyl\Models\Database|int $database
|
||||
*
|
||||
* @throws \Throwable
|
||||
*/
|
||||
public function handle(Database $database): string
|
||||
public function handle(Database|int $database): string
|
||||
{
|
||||
$password = Utilities::randomStringWithSpecialCharacters(24);
|
||||
|
||||
|
|
|
@ -11,18 +11,10 @@ use Pterodactyl\Exceptions\Service\Database\NoSuitableDatabaseHostException;
|
|||
class DeployServerDatabaseService
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Services\Databases\DatabaseManagementService
|
||||
* DeployServerDatabaseService constructor.
|
||||
*/
|
||||
private $managementService;
|
||||
|
||||
/**
|
||||
* ServerDatabaseCreationService constructor.
|
||||
*
|
||||
* @param \Pterodactyl\Services\Databases\DatabaseManagementService $managementService
|
||||
*/
|
||||
public function __construct(DatabaseManagementService $managementService)
|
||||
public function __construct(private DatabaseManagementService $managementService)
|
||||
{
|
||||
$this->managementService = $managementService;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,46 +11,16 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
|||
|
||||
class HostCreationService
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\DatabaseManager
|
||||
*/
|
||||
private $databaseManager;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Extensions\DynamicDatabaseConnection
|
||||
*/
|
||||
private $dynamic;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Encryption\Encrypter
|
||||
*/
|
||||
private $encrypter;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* HostCreationService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
DatabaseManager $databaseManager,
|
||||
DatabaseHostRepositoryInterface $repository,
|
||||
DynamicDatabaseConnection $dynamic,
|
||||
Encrypter $encrypter
|
||||
private ConnectionInterface $connection,
|
||||
private DatabaseManager $databaseManager,
|
||||
private DynamicDatabaseConnection $dynamic,
|
||||
private Encrypter $encrypter,
|
||||
private DatabaseHostRepositoryInterface $repository
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->databaseManager = $databaseManager;
|
||||
$this->dynamic = $dynamic;
|
||||
$this->encrypter = $encrypter;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,25 +8,13 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
|||
|
||||
class HostDeletionService
|
||||
{
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseRepositoryInterface
|
||||
*/
|
||||
private $databaseRepository;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* HostDeletionService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
DatabaseRepositoryInterface $databaseRepository,
|
||||
DatabaseHostRepositoryInterface $repository
|
||||
private DatabaseRepositoryInterface $databaseRepository,
|
||||
private DatabaseHostRepositoryInterface $repository
|
||||
) {
|
||||
$this->databaseRepository = $databaseRepository;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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\Services\Databases\Hosts;
|
||||
|
||||
|
@ -19,45 +12,15 @@ use Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface;
|
|||
class HostUpdateService
|
||||
{
|
||||
/**
|
||||
* @var \Illuminate\Database\ConnectionInterface
|
||||
*/
|
||||
private $connection;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Database\DatabaseManager
|
||||
*/
|
||||
private $databaseManager;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Extensions\DynamicDatabaseConnection
|
||||
*/
|
||||
private $dynamic;
|
||||
|
||||
/**
|
||||
* @var \Illuminate\Contracts\Encryption\Encrypter
|
||||
*/
|
||||
private $encrypter;
|
||||
|
||||
/**
|
||||
* @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface
|
||||
*/
|
||||
private $repository;
|
||||
|
||||
/**
|
||||
* DatabaseHostService constructor.
|
||||
* HostUpdateService constructor.
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
DatabaseManager $databaseManager,
|
||||
DatabaseHostRepositoryInterface $repository,
|
||||
DynamicDatabaseConnection $dynamic,
|
||||
Encrypter $encrypter
|
||||
private ConnectionInterface $connection,
|
||||
private DatabaseManager $databaseManager,
|
||||
private DynamicDatabaseConnection $dynamic,
|
||||
private Encrypter $encrypter,
|
||||
private DatabaseHostRepositoryInterface $repository
|
||||
) {
|
||||
$this->connection = $connection;
|
||||
$this->databaseManager = $databaseManager;
|
||||
$this->dynamic = $dynamic;
|
||||
$this->encrypter = $encrypter;
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Reference in a new issue