Files
pterodactyl-panel/app/Console/Commands/Extensions/EnableCommand.php
T
6c0413e39b Start 2.0 development
Co-authored-by: Anthony <anthony@infraly.co>
Co-authored-by: Sky Mulley <daniel.mulley@outlook.com>
2026-10-05 18:10:18 -04:00

32 lines
1019 B
PHP

<?php
declare(strict_types=1);
namespace Pterodactyl\Console\Commands\Extensions;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Pterodactyl\Contracts\Extensions\SetsExtensionEnabled;
use Pterodactyl\Exceptions\Extensions\InvalidExtensionException;
#[Description('Enable an installed extension, publishing its assets and running its migrations.')]
#[Signature('p:extension:enable {id : The extension identifier.}')]
class EnableCommand extends Command
{
public function handle(SetsExtensionEnabled $installer): int
{
try {
$installer->setEnabled($this->argument('id'), true);
} catch (InvalidExtensionException $invalidExtensionException) {
$this->components->error($invalidExtensionException->getMessage());
return self::FAILURE;
}
$this->components->info(sprintf('Extension "%s" enabled.', $this->argument('id')));
return self::SUCCESS;
}
}