Laravel 10 (#4706)

This commit is contained in:
Matthew Penner 2023-02-23 12:30:16 -07:00 committed by GitHub
parent ad4ddc6300
commit 1d38b4f0e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
136 changed files with 1735 additions and 2008 deletions

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Acl\Api;
use ReflectionClass;
use Pterodactyl\Models\ApiKey;
class AdminAcl
@ -63,7 +62,7 @@ class AdminAcl
*/
public static function getResourceList(): array
{
$reflect = new ReflectionClass(__CLASS__);
$reflect = new \ReflectionClass(__CLASS__);
return collect($reflect->getConstants())->filter(function ($value, $key) {
return substr($key, 0, 9) === 'RESOURCE_';

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Allocations;
use Exception;
use IPTools\Network;
use Pterodactyl\Models\Node;
use Illuminate\Database\ConnectionInterface;
@ -54,7 +53,7 @@ class AssignmentService
// IP to use, not multiple.
$underlying = gethostbyname($data['allocation_ip']);
$parsed = Network::parse($underlying);
} catch (Exception $exception) {
} catch (\Exception $exception) {
/* @noinspection PhpUndefinedVariableInspection */
throw new DisplayException("Could not parse provided allocation IP address ({$underlying}): {$exception->getMessage()}", $exception);
}

View file

@ -3,7 +3,6 @@
namespace Pterodactyl\Services\Databases;
use Exception;
use InvalidArgumentException;
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Database;
use Pterodactyl\Helpers\Utilities;
@ -86,7 +85,7 @@ class DatabaseManagementService
// Protect against developer mistakes...
if (empty($data['database']) || !preg_match(self::MATCH_NAME_REGEX, $data['database'])) {
throw new InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".');
throw new \InvalidArgumentException('The database name passed to DatabaseManagementService::handle MUST be prefixed with "s{server_id}_".');
}
$data = array_merge($data, [
@ -117,14 +116,14 @@ class DatabaseManagementService
return $database;
});
} catch (Exception $exception) {
} catch (\Exception $exception) {
try {
if ($database instanceof Database) {
$this->repository->dropDatabase($database->database);
$this->repository->dropUser($database->username, $database->remote);
$this->repository->flush();
}
} catch (Exception $deletionException) {
} catch (\Exception $deletionException) {
// Do nothing here. We've already encountered an issue before this point so no
// reason to prioritize this error over the initial one.
}

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Nodes;
use DateTimeImmutable;
use Carbon\CarbonImmutable;
use Illuminate\Support\Str;
use Pterodactyl\Models\Node;
@ -19,7 +18,7 @@ class NodeJWTService
private ?User $user = null;
private ?DateTimeImmutable $expiresAt;
private ?\DateTimeImmutable $expiresAt;
private ?string $subject = null;
@ -44,7 +43,7 @@ class NodeJWTService
return $this;
}
public function setExpiresAt(DateTimeImmutable $date): self
public function setExpiresAt(\DateTimeImmutable $date): self
{
$this->expiresAt = $date;

View file

@ -56,7 +56,7 @@ class ProcessScheduleService
return;
}
} catch (Exception $exception) {
} catch (\Exception $exception) {
if (!$exception instanceof DaemonConnectionException) {
// If we encountered some exception during this process that wasn't just an
// issue connecting to Wings run the failed sequence for a job. Otherwise we
@ -78,7 +78,7 @@ class ProcessScheduleService
// @see https://github.com/pterodactyl/panel/issues/2550
try {
$this->dispatcher->dispatchNow($job);
} catch (Exception $exception) {
} catch (\Exception $exception) {
$job->failed($exception);
throw $exception;

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Servers;
use Exception;
use Illuminate\Http\Response;
use Pterodactyl\Models\Server;
use Illuminate\Support\Facades\Log;
@ -61,7 +60,7 @@ class ServerDeletionService
foreach ($server->databases as $database) {
try {
$this->databaseManagementService->delete($database);
} catch (Exception $exception) {
} catch (\Exception $exception) {
if (!$this->force) {
throw $exception;
}

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Services\Telemetry;
use PDO;
use Exception;
use Ramsey\Uuid\Uuid;
use Illuminate\Support\Arr;
@ -123,7 +122,7 @@ class TelemetryCollectionService
'database' => [
'type' => config('database.default'),
'version' => DB::getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION),
'version' => DB::getPdo()->getAttribute(\PDO::ATTR_SERVER_VERSION),
],
],
],

View file

@ -2,8 +2,6 @@
namespace Pterodactyl\Services\Users;
use Exception;
use RuntimeException;
use Pterodactyl\Models\User;
use Illuminate\Contracts\Encryption\Encrypter;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
@ -38,8 +36,8 @@ class TwoFactorSetupService
for ($i = 0; $i < $this->config->get('pterodactyl.auth.2fa.bytes', 16); ++$i) {
$secret .= substr(self::VALID_BASE32_CHARACTERS, random_int(0, 31), 1);
}
} catch (Exception $exception) {
throw new RuntimeException($exception->getMessage(), 0, $exception);
} catch (\Exception $exception) {
throw new \RuntimeException($exception->getMessage(), 0, $exception);
}
$this->repository->withoutFreshModel()->update($user->id, [