HEX
Server: Apache
System: Linux srv-plesk28.ps.kz 5.14.0-284.18.1.el9_2.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 29 17:06:27 EDT 2023 x86_64
User: greencl1 (10085)
PHP: 8.1.33
Disabled: apache_setenv,dl,eval,exec,openlog,passthru,pcntl_exec,pcntl_fork,popen,posix_getpwuid,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,socket_create,socket_create_listen,socket_create_pair,syslog,system,socket_listen,stream_socket_server
Upload Files
File: /var/www/vhosts/greenclinic.kz/test.greenclinic.kz/modules/system/console/ThemeList.php
<?php namespace System\Console;

use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Cms\Classes\Theme;
use Cms\Classes\ThemeManager;
use System\Classes\UpdateManager;

/**
 * Console command to list themes.
 *
 * This lists all the available themes in the system. It also shows the active theme.
 *
 * @package october\system
 * @author Alexey Bobkov, Samuel Georges
 */
class ThemeList extends Command
{
    /**
     * The console command name.
     */
    protected $name = 'theme:list';

    /**
     * The console command description.
     */
    protected $description = 'List available themes.';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $themeManager = ThemeManager::instance();
        $updateManager = UpdateManager::instance();

        foreach (Theme::all() as $theme) {
            $flag = $theme->isActiveTheme() ? '[*] ' : '[-] ';
            $themeId = $theme->getId();
            $themeName = $themeManager->findByDirName($themeId) ?: $themeId;
            $this->info($flag . $themeName);
        }

        if ($this->option('include-marketplace')) {
            // @todo List everything in the marketplace - not just popular.

            $popularThemes = $updateManager->requestPopularProducts('theme');

            foreach ($popularThemes as $popularTheme) {
                if (!$themeManager->isInstalled($popularTheme['code'])) {
                    $this->info('[ ] '.$popularTheme['code']);
                }
            }
        }

        $this->info(PHP_EOL."[*] Active    [-] Installed    [ ] Not installed");
    }

    /**
     * Get the console command options.
     */
    protected function getOptions()
    {
        return [
            ['include-marketplace', 'm', InputOption::VALUE_NONE, 'Include downloadable themes from the October marketplace.']
        ];
    }
}