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

@ -4,7 +4,7 @@ namespace Pterodactyl\Services\Activity;
use Ramsey\Uuid\Uuid;
class AcitvityLogBatchService
class ActivityLogBatchService
{
protected int $transaction = 0;
protected ?string $uuid = null;
@ -47,10 +47,8 @@ class AcitvityLogBatchService
/**
* Executes the logic provided within the callback in the scope of an activity
* log batch transaction.
*
* @return mixed
*/
public function transaction(\Closure $callback)
public function transaction(\Closure $callback): mixed
{
$this->start();
$result = $callback($this->uuid());

View file

@ -7,11 +7,11 @@ use Webmozart\Assert\Assert;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Pterodactyl\Models\ActivityLog;
use Illuminate\Contracts\Auth\Factory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Request;
use Pterodactyl\Models\ActivityLogSubject;
use Illuminate\Database\ConnectionInterface;
use Illuminate\Contracts\Auth\Factory as AuthFactory;
class ActivityLogService
{
@ -19,24 +19,12 @@ class ActivityLogService
protected array $subjects = [];
protected Factory $manager;
protected ConnectionInterface $connection;
protected AcitvityLogBatchService $batch;
protected ActivityLogTargetableService $targetable;
public function __construct(
Factory $manager,
AcitvityLogBatchService $batch,
ActivityLogTargetableService $targetable,
ConnectionInterface $connection
protected AuthFactory $manager,
protected ActivityLogBatchService $batch,
protected ActivityLogTargetableService $targetable,
protected ConnectionInterface $connection
) {
$this->manager = $manager;
$this->batch = $batch;
$this->targetable = $targetable;
$this->connection = $connection;
}
/**
@ -75,11 +63,17 @@ class ActivityLogService
/**
* Sets the subject model instance.
*
* @param \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Model[] $subjects
* @template T extends \Illuminate\Database\Eloquent\Model|\Illuminate\Contracts\Auth\Authenticatable
*
* @param T|T[]|null $subjects
*/
public function subject(...$subjects): self
{
foreach (Arr::wrap($subjects) as $subject) {
if (is_null($subject)) {
continue;
}
foreach ($this->subjects as $entry) {
// If this subject is already tracked in our array of subjects just skip over
// it and move on to the next one in the list.
@ -170,11 +164,9 @@ class ActivityLogService
/**
* Executes the provided callback within the scope of a database transaction
* and will only save the activity log entry if everything else succesfully
* and will only save the activity log entry if everything else successfully
* settles.
*
* @return mixed
*
* @throws \Throwable
*/
public function transaction(\Closure $callback)