2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Install-state record for an extension package on disk.
|
|
|
|
|
*/
|
2026-10-11 03:10:18 -04:00
|
|
|
#[Fillable(['identifier', 'version', 'enabled', 'error', 'error_phase', 'errored_at'])]
|
2026-10-05 18:10:18 -04:00
|
|
|
class Extension extends Model
|
|
|
|
|
{
|
|
|
|
|
public const string RESOURCE_NAME = 'extension';
|
|
|
|
|
|
2026-10-11 03:10:18 -04:00
|
|
|
/**
|
|
|
|
|
* Failures that come from loading the extension. Each boot checks these again, so a
|
|
|
|
|
* clean boot clears them; any other failure stays until the extension is next
|
|
|
|
|
* enabled, disabled or installed.
|
|
|
|
|
*
|
|
|
|
|
* @var list<string>
|
|
|
|
|
*/
|
|
|
|
|
public const array LOAD_PHASES = ['register', 'boot', 'compatibility'];
|
|
|
|
|
|
|
|
|
|
public const array NO_ERROR = ['error' => null, 'error_phase' => null, 'errored_at' => null];
|
|
|
|
|
|
2026-10-05 18:10:18 -04:00
|
|
|
/**
|
|
|
|
|
* @return array<string, string>
|
|
|
|
|
*/
|
|
|
|
|
protected function casts(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
'enabled' => 'bool',
|
2026-10-11 03:10:18 -04:00
|
|
|
'errored_at' => 'datetime',
|
2026-10-05 18:10:18 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|