From 58b958f0888ef8e90b419fc707ab2d154c067615 Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Tue, 24 Oct 2023 23:21:06 +0300 Subject: [PATCH] Getting rid of code duplication, migrating to COMPOSER_RUN env.variable --- composer.inc.php | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/composer.inc.php b/composer.inc.php index 043d995..54f8e15 100644 --- a/composer.inc.php +++ b/composer.inc.php @@ -192,35 +192,16 @@ function composer_try_update_lock_entry($package, $rev, $new_tag) function composer_run(array $args) { global $GAME_ROOT; - - $composer_dir = $GAME_ROOT . '/composer/'; - - $files = glob($composer_dir . '/composer-*.phar'); - $PHAR = basename($files[0]); - - $cmd = "cd $composer_dir && "; - if(PHP_OS_FAMILY === 'Darwin') - { - $cmd .= "DYLD_LIBRARY_PATH='" . getenv("DYLD_LIBRARY_PATH") . "' " . - "PHP_INI_SCAN_DIR='" . getenv("PHP_INI_SCAN_DIR") . "' "; - $cmd .= PHP_BINARY . " -c '". getenv("PHP_INI") . "' "; - $ext_dir = realpath(ini_get('extension_dir')); - $cmd .= " -d extension_dir='$ext_dir' "; - } - else - $cmd .= PHP_BINARY . ' '; - - $cmd .= "$PHAR " . implode(' ', $args); - - shell($cmd); + putenv('COMPOSER_RUN='.implode(' ', $args)); + include("$GAME_ROOT/composer/update.php"); } //NOTE: keeping this function for BC function composer_update($update = false) { if($update) - composer_run(['update --no-dev']); + composer_run(['update']); else - composer_run(['install --no-dev']); + composer_run(['install']); }