From f323d75b6325d62742e94d3edcfdf7d84bcc2ef2 Mon Sep 17 00:00:00 2001 From: sunxyw Date: Sat, 11 Feb 2023 19:02:17 +0800 Subject: [PATCH 1/2] fix plugin dir not exists on fresh install --- src/ZM/Command/Plugin/PluginInstallCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ZM/Command/Plugin/PluginInstallCommand.php b/src/ZM/Command/Plugin/PluginInstallCommand.php index 030acca7..76c5a00d 100644 --- a/src/ZM/Command/Plugin/PluginInstallCommand.php +++ b/src/ZM/Command/Plugin/PluginInstallCommand.php @@ -7,6 +7,7 @@ namespace ZM\Command\Plugin; use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; +use ZM\Exception\FileSystemException; use ZM\Plugin\PluginManager; use ZM\Store\FileSystem; use ZM\Utils\ZMRequest; @@ -63,6 +64,12 @@ class PluginInstallCommand extends PluginCommand } } $this->info('正在从 ' . $addr . ' 克隆插件仓库'); + try { + FileSystem::createDir($plugin_dir); + } catch (FileSystemException $exception) { + $this->error("无法创建插件目录 {$plugin_dir}:{$exception->getMessage()}"); + return static::FAILURE; + } passthru('cd ' . escapeshellarg($plugin_dir) . ' && git clone --depth=1 ' . escapeshellarg($addr) . ' ' . $name, $code); if ($code !== 0) { $this->error('无法从指定 Git 地址拉取项目,请检查地址名是否正确'); From 4570012a9d7bcd894c286b00323048e0e7e1e16c Mon Sep 17 00:00:00 2001 From: sunxyw Date: Sat, 11 Feb 2023 19:03:13 +0800 Subject: [PATCH 2/2] fix plugin install not respect php binary --- src/ZM/Command/Plugin/PluginInstallCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ZM/Command/Plugin/PluginInstallCommand.php b/src/ZM/Command/Plugin/PluginInstallCommand.php index 76c5a00d..9c2aef47 100644 --- a/src/ZM/Command/Plugin/PluginInstallCommand.php +++ b/src/ZM/Command/Plugin/PluginInstallCommand.php @@ -98,7 +98,7 @@ class PluginInstallCommand extends PluginCommand // 使用内建 Composer if (file_exists(WORKING_DIR . '/runtime/composer.phar')) { $this->info('使用内建 Composer'); - passthru('php ' . escapeshellarg(WORKING_DIR . '/runtime/composer.phar') . ' install --no-dev', $code); + passthru(PHP_BINARY . ' ' . escapeshellarg(WORKING_DIR . '/runtime/composer.phar') . ' install --no-dev', $code); } else { $this->info('使用系统 Composer'); passthru('composer install --no-dev', $code);