Files
pterodactyl-panel/app/Console/Commands/Extensions/RemoveCommand.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

41 lines
1.2 KiB
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\RemovesExtensions;
use Pterodactyl\Exceptions\Extensions\InvalidExtensionException;
#[Description("Remove an extension's files, published assets, and install record.")]
#[Signature('p:extension:remove {id : The extension identifier.}')]
class RemoveCommand extends Command
{
public function handle(RemovesExtensions $installer): int
{
$id = $this->argument('id');
if ($this->input->isInteractive() && ! $this->confirm("Remove extension \"{$id}\"? Its files and published assets are deleted.")) {
return self::SUCCESS;
}
try {
$installer->remove($id);
} catch (InvalidExtensionException $invalidExtensionException) {
$this->components->error($invalidExtensionException->getMessage());
return self::FAILURE;
}
$this->components->info(sprintf(
'Extension "%s" removed. Database tables it created and its settings were left in place.',
$id,
));
return self::SUCCESS;
}
}