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\Http\Controllers\Admin;
use Exception;
use PDOException;
use Illuminate\View\View;
use Pterodactyl\Models\DatabaseHost;
use Illuminate\Http\RedirectResponse;
@ -69,8 +68,8 @@ class DatabaseController extends Controller
{
try {
$host = $this->creationService->handle($request->normalize());
} catch (Exception $exception) {
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
} catch (\Exception $exception) {
if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
$this->alert->danger(
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
)->flash();
@ -98,10 +97,10 @@ class DatabaseController extends Controller
try {
$this->updateService->handle($host->id, $request->normalize());
$this->alert->success('Database host was updated successfully.')->flash();
} catch (Exception $exception) {
} catch (\Exception $exception) {
// Catch any SQL related exceptions and display them back to the user, otherwise just
// throw the exception like normal and move on with it.
if ($exception instanceof PDOException || $exception->getPrevious() instanceof PDOException) {
if ($exception instanceof \PDOException || $exception->getPrevious() instanceof \PDOException) {
$this->alert->danger(
sprintf('There was an error while trying to connect to the host or while executing a query: "%s"', $exception->getMessage())
)->flash();

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Nests;
use JavaScript;
use Illuminate\View\View;
use Pterodactyl\Models\Egg;
use Illuminate\Http\RedirectResponse;
@ -40,7 +39,7 @@ class EggController extends Controller
public function create(): View
{
$nests = $this->nestRepository->getWithEggs();
JavaScript::put(['nests' => $nests->keyBy('id')]);
\JavaScript::put(['nests' => $nests->keyBy('id')]);
return $this->view->make('admin.eggs.new', ['nests' => $nests]);
}

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Servers;
use JavaScript;
use Illuminate\View\View;
use Pterodactyl\Models\Node;
use Pterodactyl\Models\Location;
@ -45,7 +44,7 @@ class CreateServerController extends Controller
$nests = $this->nestRepository->getWithEggs();
JavaScript::put([
\JavaScript::put([
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
'nests' => $nests->map(function ($item) {
return array_merge($item->toArray(), [

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Servers;
use JavaScript;
use Illuminate\View\View;
use Illuminate\Http\Request;
use Pterodactyl\Models\Nest;
@ -134,7 +133,7 @@ class ServerViewController extends Controller
$canTransfer = true;
}
JavaScript::put([
\JavaScript::put([
'nodeData' => $this->nodeRepository->getNodesForServerCreation(),
]);

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Admin\Settings;
use Exception;
use Illuminate\View\View;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -82,7 +81,7 @@ class MailController extends Controller
try {
Notification::route('mail', $request->user()->email)
->notify(new MailTested($request->user()));
} catch (Exception $exception) {
} catch (\Exception $exception) {
return response($exception->getMessage(), 500);
}

View file

@ -2,7 +2,6 @@
namespace Pterodactyl\Http\Controllers\Api\Client\Servers;
use Exception;
use Carbon\Carbon;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@ -178,7 +177,7 @@ class ScheduleController extends ClientApiController
$request->input('month'),
$request->input('day_of_week')
);
} catch (Exception $exception) {
} catch (\Exception $exception) {
throw new DisplayException('The cron data provided does not evaluate to a valid expression.');
}
}

View file

@ -2,9 +2,7 @@
namespace Pterodactyl\Http\Controllers\Api\Remote;
use Exception;
use Carbon\Carbon;
use DateTimeInterface;
use Illuminate\Support\Str;
use Pterodactyl\Models\User;
use Webmozart\Assert\Assert;
@ -37,11 +35,11 @@ class ActivityProcessingController extends Controller
try {
$when = Carbon::createFromFormat(
DateTimeInterface::RFC3339,
\DateTimeInterface::RFC3339,
preg_replace('/(\.\d+)Z$/', 'Z', $datum['timestamp']),
'UTC'
);
} catch (Exception $exception) {
} catch (\Exception $exception) {
Log::warning($exception, ['timestamp' => $datum['timestamp']]);
// If we cannot parse the value for some reason don't blow up this request, just go ahead