feat: 更新了MakeBootstrapCommand、MakeCommandCommand、MakeMiddlewareCommand和MakeModelCommand类以支持覆盖已存在的文件 feat: 更新了App类以修复可能的路径错误 feat: 更新了Db、Raw、ThinkPHP、Twig和Blade类以支持在视图渲染时合并变量 feat: 更新了webman文件以支持在插件中查找命令
43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Webman\Console\Commands;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
use Symfony\Component\Console\Input\InputOption;
|
|
use Webman\Console\Util;
|
|
|
|
class AppPluginUpdateCommand extends Command
|
|
{
|
|
protected static $defaultName = 'app-plugin:update';
|
|
protected static $defaultDescription = 'App Plugin Update';
|
|
|
|
/**
|
|
* @return void
|
|
*/
|
|
protected function configure()
|
|
{
|
|
$this->addArgument('name', InputArgument::REQUIRED, 'App plugin name');
|
|
}
|
|
|
|
/**
|
|
* @param InputInterface $input
|
|
* @param OutputInterface $output
|
|
* @return int
|
|
*/
|
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
|
{
|
|
$name = $input->getArgument('name');
|
|
$output->writeln("Update App Plugin $name");
|
|
$class = "\\plugin\\$name\\api\\Install";
|
|
if (!method_exists($class, 'update')) {
|
|
throw new \RuntimeException("Method $class::update not exists");
|
|
}
|
|
call_user_func([$class, 'update'], config("plugin.$name.app.version"), config("plugin.$name.app.version"));
|
|
return self::SUCCESS;
|
|
}
|
|
|
|
}
|