2026-10-05 18:10:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Console\Commands\Themes;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Console\Attributes\Description;
|
|
|
|
|
use Illuminate\Console\Attributes\Signature;
|
|
|
|
|
use Illuminate\Console\Command;
|
2026-10-12 07:47:42 -04:00
|
|
|
use Pterodactyl\Contracts\Themes\ActivatesThemes;
|
2026-10-05 18:10:18 -04:00
|
|
|
use Pterodactyl\Exceptions\Extensions\InvalidExtensionException;
|
|
|
|
|
|
2026-10-12 07:47:42 -04:00
|
|
|
#[Description('Make an installed, enabled theme the active theme.')]
|
|
|
|
|
#[Signature('p:theme:activate {id : The theme identifier, or "classic".}')]
|
|
|
|
|
class ActivateCommand extends Command
|
2026-10-05 18:10:18 -04:00
|
|
|
{
|
2026-10-12 07:47:42 -04:00
|
|
|
public function handle(ActivatesThemes $themes): int
|
2026-10-05 18:10:18 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2026-10-12 07:47:42 -04:00
|
|
|
$themes->activate($this->argument('id'));
|
2026-10-05 18:10:18 -04:00
|
|
|
} catch (InvalidExtensionException $invalidExtensionException) {
|
|
|
|
|
$this->components->error($invalidExtensionException->getMessage());
|
|
|
|
|
|
|
|
|
|
return self::FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-12 07:47:42 -04:00
|
|
|
$this->components->info(sprintf('Theme "%s" is now active.', $this->argument('id')));
|
2026-10-05 18:10:18 -04:00
|
|
|
|
|
|
|
|
return self::SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
}
|