Path: blob/1.0-develop/app/Console/Commands/InfoCommand.php
7459 views
<?php12namespace Pterodactyl\Console\Commands;34use Illuminate\Console\Command;5use Pterodactyl\Services\Helpers\SoftwareVersionService;6use Illuminate\Contracts\Config\Repository as ConfigRepository;78class InfoCommand extends Command9{10protected $description = 'Displays the application, database, and email configurations along with the panel version.';1112protected $signature = 'p:info';1314/**15* VersionCommand constructor.16*/17public function __construct(private ConfigRepository $config, private SoftwareVersionService $versionService)18{19parent::__construct();20}2122/**23* Handle execution of command.24*/25public function handle()26{27$this->output->title('Version Information');28$this->table([], [29['Panel Version', $this->config->get('app.version')],30['Latest Version', $this->versionService->getPanel()],31['Up-to-Date', $this->versionService->isLatestPanel() ? 'Yes' : $this->formatText('No', 'bg=red')],32['Unique Identifier', $this->config->get('pterodactyl.service.author')],33], 'compact');3435$this->output->title('Application Configuration');36$this->table([], [37['Environment', $this->formatText($this->config->get('app.env'), $this->config->get('app.env') === 'production' ?: 'bg=red')],38['Debug Mode', $this->formatText($this->config->get('app.debug') ? 'Yes' : 'No', !$this->config->get('app.debug') ?: 'bg=red')],39['Installation URL', $this->config->get('app.url')],40['Installation Directory', base_path()],41['Timezone', $this->config->get('app.timezone')],42['Cache Driver', $this->config->get('cache.default')],43['Queue Driver', $this->config->get('queue.default')],44['Session Driver', $this->config->get('session.driver')],45['Filesystem Driver', $this->config->get('filesystems.default')],46['Default Theme', $this->config->get('themes.active')],47['Proxies', $this->config->get('trustedproxies.proxies')],48], 'compact');4950$this->output->title('Database Configuration');51$driver = $this->config->get('database.default');52$this->table([], [53['Driver', $driver],54['Host', $this->config->get("database.connections.$driver.host")],55['Port', $this->config->get("database.connections.$driver.port")],56['Database', $this->config->get("database.connections.$driver.database")],57['Username', $this->config->get("database.connections.$driver.username")],58], 'compact');5960// TODO: Update this to handle other mail drivers61$this->output->title('Email Configuration');62$this->table([], [63['Driver', $this->config->get('mail.default')],64['Host', $this->config->get('mail.mailers.smtp.host')],65['Port', $this->config->get('mail.mailers.smtp.port')],66['Username', $this->config->get('mail.mailers.smtp.username')],67['From Address', $this->config->get('mail.from.address')],68['From Name', $this->config->get('mail.from.name')],69['Encryption', $this->config->get('mail.mailers.smtp.encryption')],70], 'compact');71}7273/**74* Format output in a Name: Value manner.75*/76private function formatText(string $value, string $opts = ''): string77{78return sprintf('<%s>%s</>', $opts, $value);79}80}818283