src/AppBundle/Command/CloseCdnCommand.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace AppBundle\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class CloseCdnCommand extends BaseCommand
{
    protected function configure()
    {
        $this->setName('cdn:close');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('<info>开始关闭CDN.......</info>');

        $this->initServiceKernel();
        $cdnSetting = $this->getSettingService()->get('cdn');

        if (empty($cdnSetting) || empty($cdnSetting['enabled'])) {
            $output->writeln('<info>CDN未开启</info>');
        } else {
            $cdnSetting['enabled'] = 0;
            $this->getSettingService()->set('cdn', $cdnSetting);
            $this->getLogService()->info('system', 'update_settings', 'CDN设置', $cdnSetting);
            $output->writeln('<info>关闭成功</info>');
        }
    }

    protected function getSettingService()
    {
        return $this->getServiceKernel()->createService('System:SettingService');
    }

    protected function getLogService()
    {
        return $this->getServiceKernel()->createService('System:LogService');
    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。