From 1b5a5763e930899f614be7ad2e3e018d69748100 Mon Sep 17 00:00:00 2001 From: Kentaro Ohkouchi Date: Thu, 30 Jun 2022 16:19:49 +0900 Subject: [PATCH] =?UTF-8?q?ComposerApi=20=E3=82=92=E3=82=B3=E3=83=BC?= =?UTF-8?q?=E3=83=AB=E3=81=99=E3=82=8B=E9=9A=9B=E3=81=AF=20symfony/flex=20?= =?UTF-8?q?=E3=83=97=E3=83=A9=E3=82=B0=E3=82=A4=E3=83=B3=E3=82=92=E7=84=A1?= =?UTF-8?q?=E5=8A=B9=E5=8C=96=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - WebAPI プラグインなど, 依存する bundle が存在する場合, app/config/eccube/bundles.php に自動登録されてしまうのを防ぐ - プラグイン削除時 bundle によっては自動削除されないためエラーになってしまう --- .../Service/Composer/ComposerApiService.php | 61 ++++++++++++++----- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/src/Eccube/Service/Composer/ComposerApiService.php b/src/Eccube/Service/Composer/ComposerApiService.php index e30f907dbc9..74d9f8fb9a4 100644 --- a/src/Eccube/Service/Composer/ComposerApiService.php +++ b/src/Eccube/Service/Composer/ComposerApiService.php @@ -105,16 +105,23 @@ public function execRequire($packageName, $output = null) { $packageName = explode(' ', trim($packageName)); - return $this->runCommand([ - 'command' => 'require', - 'packages' => $packageName, - '--no-interaction' => true, - '--profile' => true, - '--prefer-dist' => true, - '--update-with-dependencies' => true, - '--no-scripts' => true, - '--update-no-dev' => env('APP_ENV') === 'prod', - ], $output); + $this->init(); + $this->execConfig('allow-plugins.symfony/flex', ['false']); + + try { + return $this->runCommand([ + 'command' => 'require', + 'packages' => $packageName, + '--no-interaction' => true, + '--profile' => true, + '--prefer-dist' => true, + '--update-with-dependencies' => true, + '--no-scripts' => true, + '--update-no-dev' => env('APP_ENV') === 'prod', + ], $output, false); + } finally { + $this->execConfig('allow-plugins.symfony/flex', ['true']); + } } /** @@ -135,7 +142,11 @@ public function execRemove($packageName, $output = null) $packageName = explode(' ', trim($packageName)); - return $this->runCommand([ + $this->init(); + $this->execConfig('allow-plugins.symfony/flex', ['false']); + + try { + return $this->runCommand([ 'command' => 'remove', 'packages' => $packageName, '--ignore-platform-reqs' => true, @@ -143,7 +154,10 @@ public function execRemove($packageName, $output = null) '--profile' => true, '--no-scripts' => true, '--update-no-dev' => env('APP_ENV') === 'prod', - ], $output); + ], $output, false); + } finally { + $this->execConfig('allow-plugins.symfony/flex', ['true']); + } } /** @@ -158,14 +172,21 @@ public function execRemove($packageName, $output = null) */ public function execUpdate($dryRun, $output = null) { - $this->runCommand([ + $this->init(); + $this->execConfig('allow-plugins.symfony/flex', ['false']); + + try { + $this->runCommand([ 'command' => 'update', '--no-interaction' => true, '--profile' => true, '--no-scripts' => true, '--dry-run' => (bool) $dryRun, '--no-dev' => env('APP_ENV') === 'prod', - ], $output); + ], $output, false); + } finally { + $this->execConfig('allow-plugins.symfony/flex', ['true']); + } } /** @@ -180,14 +201,22 @@ public function execUpdate($dryRun, $output = null) */ public function execInstall($dryRun, $output = null) { - $this->runCommand([ + $this->init(); + $this->execConfig('allow-plugins.symfony/flex', ['false']); + + try { + $this->runCommand([ 'command' => 'install', '--no-interaction' => true, '--profile' => true, '--no-scripts' => true, '--dry-run' => (bool) $dryRun, '--no-dev' => env('APP_ENV') === 'prod', - ], $output); + ], $output, false); + } finally { + $this->execConfig('allow-plugins.symfony/flex', ['true']); + } + } /**