Skip to content

Commit

Permalink
Merge pull request #5416 from nanasess/flex-disallow
Browse files Browse the repository at this point in the history
[4.2] ComposerApi をコールする際は symfony/flex を無効化する
  • Loading branch information
chihiro-adachi authored Jul 1, 2022
2 parents ce01d40 + 1b5a576 commit e5642d2
Showing 1 changed file with 45 additions and 16 deletions.
61 changes: 45 additions & 16 deletions src/Eccube/Service/Composer/ComposerApiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}
}

/**
Expand All @@ -135,15 +142,22 @@ 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,
'--no-interaction' => true,
'--profile' => true,
'--no-scripts' => true,
'--update-no-dev' => env('APP_ENV') === 'prod',
], $output);
], $output, false);
} finally {
$this->execConfig('allow-plugins.symfony/flex', ['true']);
}
}

/**
Expand All @@ -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']);
}
}

/**
Expand All @@ -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']);
}

}

/**
Expand Down

0 comments on commit e5642d2

Please sign in to comment.