From b579d2f1e7d2bdb0bf0aea1eb90ebe6f3cbd6ee5 Mon Sep 17 00:00:00 2001 From: Santeri Hurnanen Date: Wed, 12 Jun 2024 12:11:20 +0300 Subject: [PATCH] Update composer --- src/Update/migrations.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Update/migrations.php b/src/Update/migrations.php index 884d4f6..7a4172d 100644 --- a/src/Update/migrations.php +++ b/src/Update/migrations.php @@ -146,3 +146,24 @@ function drupal_tools_update_6(UpdateOptions $options, FileManager $fileManager) ]); return new UpdateResult(['Attempted to remove docker-compose.yml file.']); } + +/** + * Update composer/composer. + */ +function drupal_tools_update_7() : UpdateResult { + $command = ['composer', 'show', 'composer/composer']; + + $process = new Process($command); + $process->run(); + + if (!$process->isSuccessful()) { + return new UpdateResult(['composer/composer is not installed. Skipping ...']); + } + + $command = ['composer', 'update', 'composer/composer:2.7.7', '-W']; + + $process = new Process($command); + $process->mustRun(); + + return new UpdateResult(['Updated composer/composer.']); +}