src/AppBundle/Command/BuildThemeAppCommand.php

(开头部分) 1KB

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

<?php

namespace AppBundle\Command;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Filesystem\Filesystem;
use AppBundle\Common\BlockToolkit;
use ZipArchive;

class BuildThemeAppCommand extends BaseCommand
{
    /**
     * @var OutputInterface
     */
    protected $output;

    /**
     * @var Filesystem
     */
    protected $filesystem;

    protected function configure()
    {
        $this->setName('build:theme-app')
            ->addArgument('name', InputArgument::REQUIRED, 'theme name');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->initServiceKernel();
        $this->output = $output;
        $this->filesystem = new Filesystem();
        $name = $input->getArgument('name');

        $this->output->writeln("<info>开始制作 主题(Theme)应用包 {$name}</info>");

        $this->_buildDistPackage($name);
    }

    private function _copyScript($name, $themeDir, $distDir)
    {
        $scriptDir = "{$themeDir}/Scripts";
        $distScriptDir = "{$distDir}/Scripts";
        if ($this->filesystem->exists($scriptDir)) {
            $this->filesystem->mirror($scriptDir, $distScriptDir);
            $this->output->writeln("<info>    * 拷贝脚本:{$scriptDir} -> {$distScriptDir}</info>");
        } else {
            $this->output->writeln('<comment>    * 拷贝脚本:无</comment>');
        }

        $this->output->writeln('<info>    * 生成安装引导脚本:EduSohoPluginUpgrade.php</info>');

        $data = file_get_contents(__DIR__.'/Fixtures/ThemeAppUpgradeTemplate.php');
        $data = str_replace('{{name}}', $name, $data);
        file_put_contents("{$distDir}/EduSohoPluginUpgrade.php", $data);
    }

    private function _generateBlocks($themeDir, $distDir, $container)

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

AI 解读 AI

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

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