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

@ -15,48 +15,22 @@ use Pterodactyl\Exceptions\Service\Node\ConfigurationNotPersistedException;
class NodeUpdateService
{
/**
* @var \Illuminate\Database\ConnectionInterface
*/
private $connection;
/**
* @var \Pterodactyl\Repositories\Wings\DaemonConfigurationRepository
*/
private $configurationRepository;
/**
* @var \Illuminate\Contracts\Encryption\Encrypter
*/
private $encrypter;
/**
* @var \Pterodactyl\Repositories\Eloquent\NodeRepository
*/
private $repository;
/**
* UpdateService constructor.
* NodeUpdateService constructor.
*/
public function __construct(
ConnectionInterface $connection,
Encrypter $encrypter,
DaemonConfigurationRepository $configurationRepository,
NodeRepository $repository
private ConnectionInterface $connection,
private DaemonConfigurationRepository $configurationRepository,
private Encrypter $encrypter,
private NodeRepository $repository
) {
$this->connection = $connection;
$this->configurationRepository = $configurationRepository;
$this->encrypter = $encrypter;
$this->repository = $repository;
}
/**
* Update the configuration values for a given node on the machine.
*
* @return \Pterodactyl\Models\Node
*
* @throws \Throwable
*/
public function handle(Node $node, array $data, bool $resetToken = false)
public function handle(Node $node, array $data, bool $resetToken = false): Node
{
if ($resetToken) {
$data['daemon_token'] = $this->encrypter->encrypt(Str::random(Node::DAEMON_TOKEN_LENGTH));
@ -87,7 +61,7 @@ class NodeUpdateService
// but something went wrong with Wings we just want to store the update and let the user manually
// make changes as needed.
//
// This avoids issues with proxies such as CloudFlare which will see Wings as offline and then
// This avoids issues with proxies such as Cloudflare which will see Wings as offline and then
// inject their own response pages, causing this logic to get fucked up.
//
// @see https://github.com/pterodactyl/panel/issues/2712