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

@ -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.
}