Upgrade to Laravel 9 (#4413)

Co-authored-by: DaneEveritt <dane@daneeveritt.com>
This commit is contained in:
Matthew Penner 2022-10-14 10:59:20 -06:00 committed by GitHub
parent 95e15d2c8a
commit cbcf62086f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
573 changed files with 4387 additions and 9411 deletions

View file

@ -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\Extensions;
@ -20,44 +13,22 @@ class DynamicDatabaseConnection
public const DB_COLLATION = 'utf8_unicode_ci';
public const DB_DRIVER = 'mysql';
/**
* @var \Illuminate\Config\Repository
*/
protected $config;
/**
* @var \Illuminate\Contracts\Encryption\Encrypter
*/
protected $encrypter;
/**
* @var \Pterodactyl\Contracts\Repository\DatabaseHostRepositoryInterface
*/
protected $repository;
/**
* DynamicDatabaseConnection constructor.
*/
public function __construct(
ConfigRepository $config,
DatabaseHostRepositoryInterface $repository,
Encrypter $encrypter
protected ConfigRepository $config,
protected Encrypter $encrypter,
protected DatabaseHostRepositoryInterface $repository
) {
$this->config = $config;
$this->encrypter = $encrypter;
$this->repository = $repository;
}
/**
* Adds a dynamic database connection entry to the runtime config.
*
* @param string $connection
* @param \Pterodactyl\Models\DatabaseHost|int $host
* @param string $database
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function set($connection, $host, $database = 'mysql')
public function set(string $connection, DatabaseHost|int $host, string $database = 'mysql'): void
{
if (!$host instanceof DatabaseHost) {
$host = $this->repository->find($host);