php-cs-fixer and phpstan

This commit is contained in:
Matthew Penner 2022-12-14 18:04:16 -07:00
parent 363c4fd49f
commit 7ed2be50fd
No known key found for this signature in database
25 changed files with 102 additions and 109 deletions

View file

@ -15,7 +15,7 @@ class InfoCommand extends Command
/** /**
* VersionCommand constructor. * VersionCommand constructor.
*/ */
public function __construct(private ConfigRepository $config, private SoftwareVersionService $versionService) public function __construct(private ConfigRepository $config, private SoftwareVersionService $softwareVersionService)
{ {
parent::__construct(); parent::__construct();
} }
@ -27,9 +27,9 @@ class InfoCommand extends Command
{ {
$this->output->title('Version Information'); $this->output->title('Version Information');
$this->table([], [ $this->table([], [
['Panel Version', $this->config->get('app.version')], ['Panel Version', $this->softwareVersionService->getCurrentVersion()],
['Latest Version', $this->versionService->getPanel()], ['Latest Version', $this->softwareVersionService->getLatestPanel()],
['Up-to-Date', $this->versionService->isLatestPanel() ? 'Yes' : $this->formatText('No', 'bg=red')], ['Up-to-Date', $this->softwareVersionService->isLatestPanel() ? 'Yes' : $this->formatText('No', 'bg=red')],
['Unique Identifier', $this->config->get('pterodactyl.service.author')], ['Unique Identifier', $this->config->get('pterodactyl.service.author')],
], 'compact'); ], 'compact');

View file

@ -30,7 +30,7 @@ class NodeDeploymentController extends ApplicationApiController
$nodes = $this->viableNodesService->setLocations($data['location_ids'] ?? []) $nodes = $this->viableNodesService->setLocations($data['location_ids'] ?? [])
->setMemory($data['memory']) ->setMemory($data['memory'])
->setDisk($data['disk']) ->setDisk($data['disk'])
->handle($request->query('per_page'), $request->query('page')); // @phpstan-ignore-line ->handle($request->query('per_page'), $request->query('page'));
return $this->fractal->collection($nodes) return $this->fractal->collection($nodes)
->transformWith(NodeTransformer::class) ->transformWith(NodeTransformer::class)

View file

@ -8,6 +8,6 @@ class UpdateDatabaseRequest extends StoreDatabaseRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return $rules ?? DatabaseHost::getRulesForUpdate($this->route()->parameter('databaseHost')->id); return $rules ?? DatabaseHost::getRulesForUpdate($this->route()->parameter('databaseHost'));
} }
} }

View file

@ -8,7 +8,7 @@ class UpdateLocationRequest extends StoreLocationRequest
{ {
public function rules(): array public function rules(): array
{ {
$locationId = $this->route()->parameter('location')->id; $locationId = $this->route()->parameter('location');
return collect(Location::getRulesForUpdate($locationId))->only([ return collect(Location::getRulesForUpdate($locationId))->only([
'short', 'short',

View file

@ -8,6 +8,6 @@ class UpdateMountRequest extends StoreMountRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return $rules ?? Mount::getRulesForUpdate($this->route()->parameter('mount')->id); return $rules ?? Mount::getRulesForUpdate($this->route()->parameter('mount'));
} }
} }

View file

@ -8,6 +8,6 @@ class UpdateNestRequest extends StoreNestRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return $rules ?? Nest::getRulesForUpdate($this->route()->parameter('nest')->id); return $rules ?? Nest::getRulesForUpdate($this->route()->parameter('nest'));
} }
} }

View file

@ -42,10 +42,8 @@ class StoreNodeRequest extends ApplicationApiRequest
/** /**
* Fields to rename for clarity in the API response. * Fields to rename for clarity in the API response.
*
* @return array
*/ */
public function attributes() public function attributes(): array
{ {
return [ return [
'daemon_base' => 'Daemon Base Path', 'daemon_base' => 'Daemon Base Path',
@ -58,13 +56,8 @@ class StoreNodeRequest extends ApplicationApiRequest
/** /**
* Change the formatting of some data keys in the validated response data * Change the formatting of some data keys in the validated response data
* to match what the application expects in the services. * to match what the application expects in the services.
*
* @param string|null $key
* @param string|array|null $default
*
* @return mixed
*/ */
public function validated($key = null, $default = null) public function validated($key = null, $default = null): array
{ {
$response = parent::validated(); $response = parent::validated();
$response['daemon_base'] = $response['daemon_base'] ?? Node::DEFAULT_DAEMON_BASE; $response['daemon_base'] = $response['daemon_base'] ?? Node::DEFAULT_DAEMON_BASE;

View file

@ -8,6 +8,6 @@ class UpdateNodeRequest extends StoreNodeRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return parent::rules($rules ?? Node::getRulesForUpdate($this->route()->parameter('node')->id)); return parent::rules($rules ?? Node::getRulesForUpdate($this->route()->parameter('node')));
} }
} }

View file

@ -8,6 +8,6 @@ class UpdateRoleRequest extends StoreRoleRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return $rules ?? AdminRole::getRulesForUpdate($this->route()->parameter('role')->id); return $rules ?? AdminRole::getRulesForUpdate($this->route()->parameter('role'));
} }
} }

View file

@ -13,7 +13,7 @@ class UpdateServerBuildConfigurationRequest extends ServerWriteRequest
*/ */
public function rules(): array public function rules(): array
{ {
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id); $rules = Server::getRulesForUpdate($this->route()->parameter('server'));
return [ return [
'allocation' => $rules['allocation_id'], 'allocation' => $rules['allocation_id'],

View file

@ -12,7 +12,7 @@ class UpdateServerDetailsRequest extends ServerWriteRequest
*/ */
public function rules(): array public function rules(): array
{ {
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id); $rules = Server::getRulesForUpdate($this->route()->parameter('server'));
return [ return [
'external_id' => $rules['external_id'], 'external_id' => $rules['external_id'],

View file

@ -9,7 +9,7 @@ class UpdateServerStartupRequest extends ApplicationApiRequest
{ {
public function rules(): array public function rules(): array
{ {
$rules = Server::getRulesForUpdate($this->route()->parameter('server')->id); $rules = Server::getRulesForUpdate($this->route()->parameter('server'));
return [ return [
'startup' => $rules['startup'], 'startup' => $rules['startup'],

View file

@ -8,6 +8,6 @@ class UpdateUserRequest extends StoreUserRequest
{ {
public function rules(array $rules = null): array public function rules(array $rules = null): array
{ {
return parent::rules($rules ?? User::getRulesForUpdate($this->route()->parameter('user')->id)); return parent::rules($rules ?? User::getRulesForUpdate($this->route()->parameter('user')));
} }
} }

View file

@ -11,6 +11,7 @@ use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
class UpdateEmailRequest extends ClientApiRequest class UpdateEmailRequest extends ClientApiRequest
{ {
/** /**
* @throws \Illuminate\Contracts\Container\BindingResolutionException
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException * @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
*/ */
public function authorize(): bool public function authorize(): bool

View file

@ -2,6 +2,8 @@
namespace Pterodactyl\Models; namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\HasMany;
/** /**
* @property int $id * @property int $id
* @property string $name * @property string $name
@ -19,15 +21,11 @@ class AdminRole extends Model
/** /**
* The table associated with the model. * The table associated with the model.
*
* @var string
*/ */
protected $table = 'admin_roles'; protected $table = 'admin_roles';
/** /**
* Fields that are mass assignable. * Fields that are mass assignable.
*
* @var array
*/ */
protected $fillable = [ protected $fillable = [
'name', 'name',
@ -37,8 +35,6 @@ class AdminRole extends Model
/** /**
* Cast values to correct type. * Cast values to correct type.
*
* @var array
*/ */
protected $casts = [ protected $casts = [
'sort_id' => 'int', 'sort_id' => 'int',
@ -51,17 +47,12 @@ class AdminRole extends Model
'sort_id' => 'sometimes|numeric', 'sort_id' => 'sometimes|numeric',
]; ];
/**
* @var bool
*/
public $timestamps = false; public $timestamps = false;
/** /**
* Gets the permissions associated with a admin role. * Gets the permissions associated with an admin role.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/ */
public function permissions() public function permissions(): HasMany
{ {
return $this->hasMany(Permission::class); return $this->hasMany(Permission::class);
} }

View file

@ -2,8 +2,8 @@
namespace Pterodactyl\Models; namespace Pterodactyl\Models;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/** /**
* @property int $id * @property int $id
@ -19,7 +19,7 @@ use Illuminate\Database\Eloquent\Relations\HasMany;
* @property \Carbon\CarbonImmutable $updated_at * @property \Carbon\CarbonImmutable $updated_at
* @property bool $required * @property bool $required
* @property Egg $egg * @property Egg $egg
* @property ServerVariable $serverVariable * @property ServerVariable $serverVariables
* @property string $field_type * @property string $field_type
* *
* The "server_value" variable is only present on the object if you've loaded this model * The "server_value" variable is only present on the object if you've loaded this model
@ -81,15 +81,18 @@ class EggVariable extends Model
return in_array('required', explode('|', $this->rules)); return in_array('required', explode('|', $this->rules));
} }
public function egg(): HasOne /**
* Returns the egg that this variable belongs to.
*/
public function egg(): BelongsTo
{ {
return $this->hasOne(Egg::class); return $this->belongsTo(Egg::class);
} }
/** /**
* Return server variables associated with this variable. * Return server variables associated with this variable.
*/ */
public function serverVariable(): HasMany public function serverVariables(): HasMany
{ {
return $this->hasMany(ServerVariable::class, 'variable_id'); return $this->hasMany(ServerVariable::class, 'variable_id');
} }

View file

@ -19,8 +19,13 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
* @property string $name * @property string $name
* @property string|null $description * @property string|null $description
* @property int $location_id * @property int $location_id
* @property string $fqdn * @property int|null $database_host_id
* @property string $scheme * @property string $scheme
* @property string $fqdn
* @property int $listen_port_http
* @property int $listen_port_sftp
* @property int $public_port_http
* @property int $public_port_sftp
* @property bool $behind_proxy * @property bool $behind_proxy
* @property bool $maintenance_mode * @property bool $maintenance_mode
* @property int $memory * @property int $memory
@ -32,17 +37,16 @@ use Illuminate\Database\Eloquent\Relations\HasManyThrough;
* @property int $upload_size * @property int $upload_size
* @property string $daemon_token_id * @property string $daemon_token_id
* @property string $daemon_token * @property string $daemon_token
* @property int $daemonListen * @property string $daemon_base
* @property int $daemonSFTP
* @property string $daemonBase
* @property int $servers_count * @property int $servers_count
* @property \Carbon\Carbon $created_at * @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at * @property \Carbon\Carbon $updated_at
* @property Location $location
* @property int[]|\Illuminate\Support\Collection $ports
* @property Mount[]|Collection $mounts
* @property Server[]|Collection $servers
* @property Allocation[]|Collection $allocations * @property Allocation[]|Collection $allocations
* @property \Pterodactyl\Models\DatabaseHost|null $databaseHost
* @property Location $location
* @property Mount[]|Collection $mounts
* @property int[]|\Illuminate\Support\Collection $ports
* @property Server[]|Collection $servers
*/ */
class Node extends Model class Node extends Model
{ {
@ -54,6 +58,11 @@ class Node extends Model
*/ */
public const RESOURCE_NAME = 'node'; public const RESOURCE_NAME = 'node';
/**
* The default location of server files on the Wings instance.
*/
public const DEFAULT_DAEMON_BASE = '/var/lib/pterodactyl/volumes';
public const DAEMON_TOKEN_ID_LENGTH = 16; public const DAEMON_TOKEN_ID_LENGTH = 16;
public const DAEMON_TOKEN_LENGTH = 64; public const DAEMON_TOKEN_LENGTH = 64;
@ -72,10 +81,13 @@ class Node extends Model
*/ */
protected $casts = [ protected $casts = [
'location_id' => 'integer', 'location_id' => 'integer',
'database_host_id' => 'integer',
'listen_port_http' => 'integer',
'listen_port_sftp' => 'integer',
'public_port_http' => 'integer',
'public_port_sftp' => 'integer',
'memory' => 'integer', 'memory' => 'integer',
'disk' => 'integer', 'disk' => 'integer',
'daemonListen' => 'integer',
'daemonSFTP' => 'integer',
'behind_proxy' => 'boolean', 'behind_proxy' => 'boolean',
'public' => 'boolean', 'public' => 'boolean',
'maintenance_mode' => 'boolean', 'maintenance_mode' => 'boolean',
@ -85,11 +97,11 @@ class Node extends Model
* Fields that are mass assignable. * Fields that are mass assignable.
*/ */
protected $fillable = [ protected $fillable = [
'public', 'name', 'location_id', 'public', 'name', 'location_id', 'database_host_id',
'listen_port_http', 'listen_port_sftp', 'public_port_http', 'public_port_sftp',
'fqdn', 'scheme', 'behind_proxy', 'fqdn', 'scheme', 'behind_proxy',
'memory', 'memory_overallocate', 'disk', 'memory', 'memory_overallocate', 'disk',
'disk_overallocate', 'upload_size', 'daemonBase', 'disk_overallocate', 'upload_size', 'daemon_base',
'daemonSFTP', 'daemonListen',
'description', 'maintenance_mode', 'description', 'maintenance_mode',
]; ];
@ -97,17 +109,20 @@ class Node extends Model
'name' => 'required|regex:/^([\w .-]{1,100})$/', 'name' => 'required|regex:/^([\w .-]{1,100})$/',
'description' => 'string|nullable', 'description' => 'string|nullable',
'location_id' => 'required|exists:locations,id', 'location_id' => 'required|exists:locations,id',
'database_host_id' => 'sometimes|nullable|exists:database_hosts,id',
'public' => 'boolean', 'public' => 'boolean',
'fqdn' => 'required|string', 'fqdn' => 'required|string',
'listen_port_http' => 'required|numeric|between:1,65535',
'listen_port_sftp' => 'required|numeric|between:1,65535',
'public_port_http' => 'required|numeric|between:1,65535',
'public_port_sftp' => 'required|numeric|between:1,65535',
'scheme' => 'required', 'scheme' => 'required',
'behind_proxy' => 'boolean', 'behind_proxy' => 'boolean',
'memory' => 'required|numeric|min:1', 'memory' => 'required|numeric|min:1',
'memory_overallocate' => 'required|numeric|min:-1', 'memory_overallocate' => 'required|numeric|min:-1',
'disk' => 'required|numeric|min:1', 'disk' => 'required|numeric|min:1',
'disk_overallocate' => 'required|numeric|min:-1', 'disk_overallocate' => 'required|numeric|min:-1',
'daemonBase' => 'sometimes|required|regex:/^([\/][\d\w.\-\/]+)$/', 'daemon_base' => 'sometimes|required|regex:/^([\/][\d\w.\-\/]+)$/',
'daemonSFTP' => 'required|numeric|between:1,65535',
'daemonListen' => 'required|numeric|between:1,65535',
'maintenance_mode' => 'boolean', 'maintenance_mode' => 'boolean',
'upload_size' => 'int|between:1,1024', 'upload_size' => 'int|between:1,1024',
]; ];
@ -116,13 +131,15 @@ class Node extends Model
* Default values for specific columns that are generally not changed on base installs. * Default values for specific columns that are generally not changed on base installs.
*/ */
protected $attributes = [ protected $attributes = [
'listen_port_http' => 8080,
'listen_port_sftp' => 2022,
'public_port_http' => 8080,
'public_port_sftp' => 2022,
'public' => true, 'public' => true,
'behind_proxy' => false, 'behind_proxy' => false,
'memory_overallocate' => 0, 'memory_overallocate' => 0,
'disk_overallocate' => 0, 'disk_overallocate' => 0,
'daemonBase' => '/var/lib/pterodactyl/volumes', 'daemon_base' => self::DEFAULT_DAEMON_BASE,
'daemonSFTP' => 2022,
'daemonListen' => 8080,
'maintenance_mode' => false, 'maintenance_mode' => false,
]; ];
@ -146,7 +163,7 @@ class Node extends Model
'token' => Container::getInstance()->make(Encrypter::class)->decrypt($this->daemon_token), 'token' => Container::getInstance()->make(Encrypter::class)->decrypt($this->daemon_token),
'api' => [ 'api' => [
'host' => '0.0.0.0', 'host' => '0.0.0.0',
'port' => $this->daemonListen, 'port' => $this->listen_port_http,
'ssl' => [ 'ssl' => [
'enabled' => (!$this->behind_proxy && $this->scheme === 'https'), 'enabled' => (!$this->behind_proxy && $this->scheme === 'https'),
'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem', 'cert' => '/etc/letsencrypt/live/' . Str::lower($this->fqdn) . '/fullchain.pem',
@ -155,9 +172,9 @@ class Node extends Model
'upload_limit' => $this->upload_size, 'upload_limit' => $this->upload_size,
], ],
'system' => [ 'system' => [
'data' => $this->daemonBase, 'data' => $this->daemon_base,
'sftp' => [ 'sftp' => [
'bind_port' => $this->daemonSFTP, 'bind_port' => $this->listen_port_sftp,
], ],
], ],
'allowed_mounts' => $this->mounts->pluck('source')->toArray(), 'allowed_mounts' => $this->mounts->pluck('source')->toArray(),
@ -196,9 +213,20 @@ class Node extends Model
return $this->maintenance_mode; return $this->maintenance_mode;
} }
public function mounts(): HasManyThrough /**
* Gets the allocations associated with a node.
*/
public function allocations(): HasMany
{ {
return $this->hasManyThrough(Mount::class, MountNode::class, 'node_id', 'id', 'id', 'mount_id'); return $this->hasMany(Allocation::class);
}
/**
* Returns the database host associated with a node.
*/
public function databaseHost(): BelongsTo
{
return $this->belongsTo(DatabaseHost::class);
} }
/** /**
@ -209,6 +237,14 @@ class Node extends Model
return $this->belongsTo(Location::class); return $this->belongsTo(Location::class);
} }
/**
* Returns a HasManyThrough relationship for all the mounts associated with a node.
*/
public function mounts(): HasManyThrough
{
return $this->hasManyThrough(Mount::class, MountNode::class, 'node_id', 'id', 'id', 'mount_id');
}
/** /**
* Gets the servers associated with a node. * Gets the servers associated with a node.
*/ */
@ -217,14 +253,6 @@ class Node extends Model
return $this->hasMany(Server::class); return $this->hasMany(Server::class);
} }
/**
* Gets the allocations associated with a node.
*/
public function allocations(): HasMany
{
return $this->hasMany(Allocation::class);
}
public function loadServerSums(): self public function loadServerSums(): self
{ {
$this->loadSum('servers as sum_memory', 'memory'); $this->loadSum('servers as sum_memory', 'memory');

View file

@ -116,7 +116,7 @@ class EggImporterService
'copy_script_from' => null, 'copy_script_from' => null,
]); ]);
$egg = $this->parser->fillFromParsed($egg, $parsed); $egg = $this->eggParserService->fillFromParsed($egg, $parsed);
$egg->save(); $egg->save();
foreach ($parsed['variables'] ?? [] as $variable) { foreach ($parsed['variables'] ?? [] as $variable) {

View file

@ -8,7 +8,6 @@ use Pterodactyl\Models\EggVariable;
use Pterodactyl\Exceptions\DisplayException; use Pterodactyl\Exceptions\DisplayException;
use Pterodactyl\Traits\Services\ValidatesValidationRules; use Pterodactyl\Traits\Services\ValidatesValidationRules;
use Illuminate\Contracts\Validation\Factory as ValidationFactory; use Illuminate\Contracts\Validation\Factory as ValidationFactory;
use Pterodactyl\Contracts\Repository\EggVariableRepositoryInterface;
use Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException; use Pterodactyl\Exceptions\Service\Egg\Variable\ReservedVariableNameException;
class VariableUpdateService class VariableUpdateService
@ -18,7 +17,7 @@ class VariableUpdateService
/** /**
* VariableUpdateService constructor. * VariableUpdateService constructor.
*/ */
public function __construct(private EggVariableRepositoryInterface $repository, private ValidationFactory $validator) public function __construct(private ValidationFactory $validator)
{ {
} }

View file

@ -122,7 +122,7 @@ class SoftwareVersionService
protected function versionData(): array protected function versionData(): array
{ {
return $this->cache->remember(self::GIT_VERSION_CACHE_KEY, CarbonImmutable::now()->addSeconds(15), function () { return $this->cache->remember(self::GIT_VERSION_CACHE_KEY, CarbonImmutable::now()->addSeconds(15), function () {
$configVersion = config()->get('app.version'); $configVersion = $this->getCurrentVersion();
if (file_exists(base_path('.git/HEAD'))) { if (file_exists(base_path('.git/HEAD'))) {
$head = explode(' ', file_get_contents(base_path('.git/HEAD'))); $head = explode(' ', file_get_contents(base_path('.git/HEAD')));

View file

@ -16,6 +16,7 @@ use Pterodactyl\Models\Location;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Pterodactyl\Models\Allocation; use Pterodactyl\Models\Allocation;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Pterodactyl\Services\Helpers\SoftwareVersionService;
use Pterodactyl\Repositories\Eloquent\SettingsRepository; use Pterodactyl\Repositories\Eloquent\SettingsRepository;
use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository; use Pterodactyl\Repositories\Wings\DaemonConfigurationRepository;
@ -26,7 +27,8 @@ class TelemetryCollectionService
*/ */
public function __construct( public function __construct(
private DaemonConfigurationRepository $daemonConfigurationRepository, private DaemonConfigurationRepository $daemonConfigurationRepository,
private SettingsRepository $settingsRepository private SettingsRepository $settingsRepository,
private SoftwareVersionService $softwareVersionService
) { ) {
} }
@ -108,7 +110,7 @@ class TelemetryCollectionService
'id' => $uuid, 'id' => $uuid,
'panel' => [ 'panel' => [
'version' => config('app.version'), 'version' => $this->softwareVersionService->getCurrentVersion(),
'phpVersion' => phpversion(), 'phpVersion' => phpversion(),
'drivers' => [ 'drivers' => [

View file

@ -2,20 +2,12 @@
namespace Pterodactyl\Transformers\Api\Application; namespace Pterodactyl\Transformers\Api\Application;
use League\Fractal\Resource\Item;
use Pterodactyl\Models\EggVariable; use Pterodactyl\Models\EggVariable;
use Pterodactyl\Models\ServerVariable; use Pterodactyl\Models\ServerVariable;
use League\Fractal\Resource\NullResource;
use Pterodactyl\Services\Acl\Api\AdminAcl;
use Pterodactyl\Transformers\Api\Transformer; use Pterodactyl\Transformers\Api\Transformer;
class ServerVariableTransformer extends Transformer class ServerVariableTransformer extends Transformer
{ {
/**
* List of resources that can be included.
*/
protected array $availableIncludes = ['parent'];
/** /**
* Return the resource name for the JSONAPI output. * Return the resource name for the JSONAPI output.
*/ */
@ -31,17 +23,4 @@ class ServerVariableTransformer extends Transformer
{ {
return $model->toArray(); return $model->toArray();
} }
/**
* Return the parent service variable data.
*/
public function includeParent(EggVariable $variable): Item|NullResource
{
if (!$this->authorize(AdminAcl::RESOURCE_EGGS)) {
return $this->null();
}
// TODO: what the fuck?
return $this->item($variable->variable, new EggVariableTransformer());
}
} }

View file

@ -17,7 +17,7 @@ return new class () extends Migration {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->integer('database_host_id')->nullable()->unsigned()->after('location_id'); $table->integer('database_host_id')->nullable()->unsigned()->after('location_id');
$table->index('database_host_id')->nullable(); $table->index('database_host_id');
$table->foreign('database_host_id')->references('id')->on('database_hosts')->onDelete('set null'); $table->foreign('database_host_id')->references('id')->on('database_hosts')->onDelete('set null');
}); });
} }
@ -34,7 +34,7 @@ return new class () extends Migration {
Schema::table('database_hosts', function (Blueprint $table) { Schema::table('database_hosts', function (Blueprint $table) {
$table->integer('node_id')->nullable()->unsigned()->after('max_databases'); $table->integer('node_id')->nullable()->unsigned()->after('max_databases');
$table->index('node_id')->nullable(); $table->index('node_id');
$table->foreign('node_id')->references('id')->on('nodes'); $table->foreign('node_id')->references('id')->on('nodes');
}); });
} }

View file

@ -19,10 +19,10 @@ return new class () extends Migration {
Schema::table('nodes', function (Blueprint $table) { Schema::table('nodes', function (Blueprint $table) {
$table->integer('listen_port_http')->unsigned()->default(8080)->after('fqdn')->change(); $table->integer('listen_port_http')->unsigned()->default(8080)->after('fqdn')->change();
$table->integer('listen_port_sftp')->unsigned()->default(2022)->after('listen_port_sftp')->change(); $table->integer('listen_port_sftp')->unsigned()->default(2022)->after('listen_port_http')->change();
$table->integer('public_port_http')->unsigned()->default(8080)->after('listen_port_http'); $table->integer('public_port_http')->unsigned()->default(8080)->after('listen_port_sftp');
$table->integer('public_port_sftp')->unsigned()->default(2022)->after('listen_port_sftp'); $table->integer('public_port_sftp')->unsigned()->default(2022)->after('public_port_http');
}); });
DB::transaction(function () { DB::transaction(function () {

View file

@ -19,9 +19,6 @@ parameters:
# Ignore magic spatie calls # Ignore magic spatie calls
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder::allowed(\w+)\(\)#' - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Builder::allowed(\w+)\(\)#'
# This should be replaced with resources instead of a magic transformer factory, robots in disguise
- '#Method Pterodactyl\\Http\\Controllers\\Api\\Client\\ClientApiController::getTransformer\(\) should return T#'
excludePaths: excludePaths:
- app/Repositories - app/Repositories