v7.0.0-beta.2 release

This commit is contained in:
HeuJung committed 2026-04-20 20:37:49 +09:00
1 parent 6595fd0eb5
commit fa8eba7a0d
1165 files changed
+107118 -762127

No files matched your search

@@ -2,10 +2,10 @@
namespace App\Console\Commands\Plugin;
use App\Contracts\Extension\CacheInterface;
use App\Contracts\Repositories\PluginRepositoryInterface;
use App\Extension\PluginManager;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Log;
class ClearPluginCacheCommand extends Command
@@ -26,7 +26,8 @@ class ClearPluginCacheCommand extends Command
*/
public function __construct(
private PluginManager $pluginManager,
private PluginRepositoryInterface $pluginRepository
private PluginRepositoryInterface $pluginRepository,
private CacheInterface $cache
) {
parent::__construct();
}
@@ -74,7 +75,7 @@ class ClearPluginCacheCommand extends Command
];
foreach ($cacheKeys as $key) {
if (Cache::forget($key)) {
if ($this->cache->forget($key)) {
$clearedCount++;
}
}
@@ -121,7 +122,7 @@ class ClearPluginCacheCommand extends Command
];
foreach ($cacheKeys as $key) {
if (Cache::forget($key)) {
if ($this->cache->forget($key)) {
$clearedCount++;
}
}
@@ -6,6 +6,7 @@ use App\Console\Commands\Traits\HasProgressBar;
use App\Contracts\Repositories\PluginRepositoryInterface;
use App\Enums\ExtensionOwnerType;
use App\Extension\PluginManager;
use App\Extension\Vendor\VendorMode;
use App\Models\Permission;
use App\Rules\ValidExtensionIdentifier;
use Illuminate\Console\Command;
@@ -19,7 +20,10 @@ class InstallPluginCommand extends Command
/**
* The name and signature of the console command.
*/
protected $signature = 'plugin:install {identifier : 설치할 플러그인 식별자}';
protected $signature = 'plugin:install
{identifier : 설치할 플러그인 식별자}
{--vendor-mode=auto : Vendor 설치 모드 (auto|composer|bundled)}
{--force : 이미 설치된 경우에도 _bundled/_pending 원본으로 활성 디렉토리를 덮어쓰고 재설치 (불완전 설치 복구)}';
/**
* The console command description.
@@ -55,22 +59,29 @@ class InstallPluginCommand extends Command
return Command::FAILURE;
}
$force = (bool) $this->option('force');
try {
// 플러그인 디렉토리 스캔 및 로드
$this->pluginManager->loadPlugins();
// 이미 설치된 플러그인인지 확인
// 이미 설치된 플러그인인지 확인 (force 시 스킵하여 재설치/복구 허용)
$existingPlugin = $this->pluginRepository->findByIdentifier($identifier);
if ($existingPlugin) {
if ($existingPlugin && ! $force) {
$this->warn('⚠️ '.__('plugins.commands.install.already_installed', ['plugin' => $identifier]));
return Command::FAILURE;
}
if ($existingPlugin && $force) {
$this->warn('⚠️ '.__('plugins.commands.install.force_reinstall', ['plugin' => $identifier]));
}
// 플러그인 설치
$vendorMode = VendorMode::fromStringOrAuto((string) $this->option('vendor-mode'));
$onProgress = $this->createProgressCallback(PluginManager::INSTALL_STEPS);
try {
$result = $this->pluginManager->installPlugin($identifier, $onProgress);
$result = $this->pluginManager->installPlugin($identifier, $onProgress, $vendorMode, $force);
$this->finishProgress();
} catch (\Exception $e) {
$this->finishProgress();
@@ -0,0 +1,56 @@
<?php
namespace App\Console\Commands\Plugin;
use App\Console\Commands\Vendor\Concerns\RunsVendorBundleAction;
use App\Extension\Vendor\VendorBundler;
use Illuminate\Console\Command;
/**
* 플러그인 vendor/ 디렉토리를 vendor-bundle.zip 으로 빌드합니다.
*
* 기존 plugin:build 패턴과 동일하게 positional identifier + --all 옵션 지원.
*/
class PluginVendorBundleCommand extends Command
{
use RunsVendorBundleAction;
protected $signature = 'plugin:vendor-bundle
{identifier? : 빌드할 플러그인 식별자 (생략 시 --all 필요)}
{--all : 모든 _bundled 플러그인 빌드}
{--force : 해시 체크 무시, 강제 재빌드}
{--check : 실제 빌드 없이 stale 여부만 확인}';
protected $description = '플러그인 vendor/ 디렉토리를 vendor-bundle.zip 으로 빌드합니다 (공유 호스팅용)';
public function handle(VendorBundler $bundler): int
{
$identifier = $this->argument('identifier');
$all = (bool) $this->option('all');
if (! $identifier && ! $all) {
$this->error('식별자 또는 --all 옵션을 지정해야 합니다.');
$this->line('사용법:');
$this->line(' php artisan plugin:vendor-bundle sirsoft-payment');
$this->line(' php artisan plugin:vendor-bundle --all');
return self::FAILURE;
}
$targets = [];
if ($all) {
foreach ($this->discoverBundledIdentifiers('plugin') as $id) {
$targets[] = ['type' => 'plugin', 'identifier' => $id];
}
} else {
$targets[] = ['type' => 'plugin', 'identifier' => $identifier];
}
return $this->runBuildAction(
$bundler,
$targets,
(bool) $this->option('force'),
(bool) $this->option('check'),
);
}
}
@@ -0,0 +1,44 @@
<?php
namespace App\Console\Commands\Plugin;
use App\Console\Commands\Vendor\Concerns\RunsVendorBundleAction;
use App\Extension\Vendor\VendorIntegrityChecker;
use Illuminate\Console\Command;
/**
* 플러그인 vendor-bundle.zip 무결성을 검증합니다.
*/
class PluginVendorVerifyCommand extends Command
{
use RunsVendorBundleAction;
protected $signature = 'plugin:vendor-verify
{identifier? : 검증할 플러그인 식별자 (생략 시 --all 필요)}
{--all : 모든 _bundled 플러그인 검증}';
protected $description = '플러그인 vendor-bundle.zip 의 SHA256 무결성을 검증합니다';
public function handle(VendorIntegrityChecker $checker): int
{
$identifier = $this->argument('identifier');
$all = (bool) $this->option('all');
if (! $identifier && ! $all) {
$this->error('식별자 또는 --all 옵션을 지정해야 합니다.');
return self::FAILURE;
}
$targets = [];
if ($all) {
foreach ($this->discoverBundledIdentifiers('plugin') as $id) {
$targets[] = ['type' => 'plugin', 'identifier' => $id];
}
} else {
$targets[] = ['type' => 'plugin', 'identifier' => $identifier];
}
return $this->runVerifyAction($checker, $targets);
}
}
@@ -5,6 +5,7 @@ namespace App\Console\Commands\Plugin;
use App\Console\Commands\Traits\HasProgressBar;
use App\Contracts\Repositories\PluginRepositoryInterface;
use App\Extension\PluginManager;
use App\Extension\Vendor\VendorMode;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;
@@ -17,7 +18,11 @@ class UpdatePluginCommand extends Command
*/
protected $signature = 'plugin:update
{identifier : 업데이트할 플러그인 식별자}
{--force : 버전 비교 없이 강제 업데이트}';
{--force : 버전 비교 없이 강제 업데이트}
{--vendor-mode=auto : Vendor 설치 모드 (auto|composer|bundled)}
{--layout-strategy=overwrite : 레이아웃 전략 (overwrite|keep)}
{--source=auto : 업데이트 소스 (auto|bundled|github) — bundled 는 _bundled 만 사용(GitHub 우회)}
{--zip= : 외부 ZIP 파일 경로 (지정 시 GitHub/번들 우회 + 버전은 plugin.json 기준)}';
/**
* The console command description.
@@ -41,6 +46,39 @@ class UpdatePluginCommand extends Command
{
$identifier = $this->argument('identifier');
$force = $this->option('force');
$layoutStrategy = (string) $this->option('layout-strategy');
$sourceOption = (string) $this->option('source');
$zipPath = $this->option('zip');
if (! in_array($layoutStrategy, ['overwrite', 'keep'], true)) {
$this->error('❌ --layout-strategy 는 overwrite 또는 keep 이어야 합니다.');
return Command::FAILURE;
}
if (! in_array($sourceOption, ['auto', 'bundled', 'github'], true)) {
$this->error('❌ --source 는 auto, bundled, github 중 하나여야 합니다.');
return Command::FAILURE;
}
if ($zipPath !== null && $sourceOption !== 'auto') {
$this->error('❌ --zip 은 --source 와 동시에 지정할 수 없습니다.');
return Command::FAILURE;
}
if ($zipPath !== null) {
$resolvedZip = realpath($zipPath);
if (! $resolvedZip || ! is_file($resolvedZip)) {
$this->error('❌ 지정된 ZIP 파일이 존재하지 않습니다: '.$zipPath);
return Command::FAILURE;
}
$zipPath = $resolvedZip;
}
$sourceOverride = $sourceOption === 'auto' ? null : $sourceOption;
try {
$this->pluginManager->loadPlugins();
@@ -54,23 +92,29 @@ class UpdatePluginCommand extends Command
return Command::FAILURE;
}
// 업데이트 확인
$checkResult = $this->pluginManager->checkPluginUpdate($identifier);
// 업데이트 확인 (--zip 모드는 GitHub/번들 비교를 우회하므로 스킵)
if ($zipPath === null) {
$checkResult = $this->pluginManager->checkPluginUpdate($identifier);
if (! $checkResult['update_available'] && ! $force) {
$this->info('✅ '.__('plugins.commands.update.no_update', ['plugin' => $identifier]));
if (! $checkResult['update_available'] && ! $force) {
$this->info('✅ '.__('plugins.commands.update.no_update', ['plugin' => $identifier]));
return Command::SUCCESS;
}
return Command::SUCCESS;
}
// 업데이트 정보 표시
$this->info(__('plugins.commands.update.current_version', ['version' => $checkResult['current_version']]));
// 업데이트 정보 표시
$this->info(__('plugins.commands.update.current_version', ['version' => $checkResult['current_version']]));
if ($force && ! $checkResult['update_available']) {
$this->warn('⚠️ '.__('plugins.commands.update.force_mode'));
if ($force && ! $checkResult['update_available']) {
$this->warn('⚠️ '.__('plugins.commands.update.force_mode'));
} else {
$this->info(__('plugins.commands.update.latest_version', ['version' => $checkResult['latest_version']]));
$this->info(__('plugins.commands.update.update_source', ['source' => $checkResult['update_source']]));
}
} else {
$this->info(__('plugins.commands.update.latest_version', ['version' => $checkResult['latest_version']]));
$this->info(__('plugins.commands.update.update_source', ['source' => $checkResult['update_source']]));
$this->info(__('plugins.commands.update.current_version', ['version' => $plugin->version]));
$this->info('업데이트 소스: ZIP ('.$zipPath.')');
$this->info('업데이트 버전: (plugin.json 추출 후 판별)');
}
$this->newLine();
@@ -83,9 +127,31 @@ class UpdatePluginCommand extends Command
}
// 업데이트 실행
$vendorMode = VendorMode::fromStringOrAuto((string) $this->option('vendor-mode'));
$onProgress = $this->createProgressCallback(PluginManager::UPDATE_STEPS);
// upgrade step 콘솔 출력 콜백: progress bar 를 잠시 지우고 별도 줄에 출력
$onUpgradeStep = function (string $version) use ($identifier): void {
if ($this->progressBar) {
$this->progressBar->clear();
}
$this->line(" • [{$identifier}] upgrade step 실행: {$version}");
if ($this->progressBar) {
$this->progressBar->display();
}
};
try {
$updateResult = $this->pluginManager->updatePlugin($identifier, $force, $onProgress);
$updateResult = $this->pluginManager->updatePlugin(
$identifier,
$force,
$onProgress,
$vendorMode,
$layoutStrategy,
$onUpgradeStep,
$sourceOverride,
$zipPath,
);
$this->finishProgress();
} catch (\Exception $e) {
$this->finishProgress();
@@ -104,6 +170,7 @@ class UpdatePluginCommand extends Command
'plugin' => $identifier,
'from' => $updateResult['from_version'],
'to' => $updateResult['to_version'],
'layout_strategy' => $layoutStrategy,
]);
return Command::SUCCESS;