src/AppBundle/Command/Fixtures/PluginAppUpgradeTemplate.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
use Symfony\Component\Filesystem\Filesystem;
use AppBundle\Common\BlockToolkit;
class EduSohoPluginUpgrade
{
protected $kernel;
protected $upgradeType;
protected $version;
public function __construct($kernel)
{
$this->kernel = $kernel;
}
public function update()
{
if (empty($this->upgradeType)) {
throw new \RuntimeException('Upgrade type is empty.');
}
if (!in_array($this->upgradeType, array('install', 'upgrade'))) {
throw new \RuntimeException("Upgrade type `{$this->upgradeType}` is error.");
}
if (('upgrade' == $this->upgradeType) && empty($this->upgradeVersion)) {
throw new \RuntimeException("Upgrade version `{$this->upgradeVersion}` is empty");
}
$method = "{$this->upgradeType}Update";
$this->$method();
}
protected function installUpdate()
{
$scriptFilePath = __DIR__.'/Scripts/InstallScript.php';
if (file_exists($scriptFilePath)) {
include $scriptFilePath;
$updater = new \InstallScript($this->kernel);
$updater->execute();
}
$this->copyStaticFile();
$this->initBlock();
}
protected function initBlock()
{
BlockToolkit::init(__DIR__.'/block.json', null, __DIR__.'/blocks/');
}
protected function upgradeUpdate()
{
$className = 'UpgradeScript'.str_replace('.', '', $this->upgradeVersion);
$scriptFilePath = __DIR__.'/Scripts/'.$className.'.php';
if (file_exists($scriptFilePath)) {
include $scriptFilePath;
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。