Conditions | 4 |
Paths | 11 |
Total Lines | 30 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
5 | public function __construct() |
||
6 | { |
||
7 | if (! file_exists(__DIR__.'/vendor/autoload.php')) { |
||
8 | |||
9 | require_once __DIR__.'/install/vendor/autoload.php'; |
||
10 | |||
11 | if(file_exists(__DIR__ . '/install/vendor/bin/composer')) { |
||
12 | echo "composer file exists"; |
||
13 | } |
||
14 | |||
15 | // Composer\Factory::getHomeDir() method |
||
16 | // needs COMPOSER_HOME environment variable set |
||
17 | putenv('COMPOSER_HOME=' . __DIR__ . '/install/vendor/bin/composer'); |
||
18 | |||
19 | // call `composer install` command programmatically |
||
20 | // if (file_exists(getcwd().'/composer.phar')) { |
||
21 | // $composer = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
||
22 | // } |
||
23 | |||
24 | $composer = 'composer'; |
||
25 | |||
26 | try { |
||
27 | $process = \Symfony\Component\Process\Process::fromShellCommandline($composer.' install'); |
||
28 | $process->setEnv([ |
||
29 | 'COMPOSER_HOME' => __DIR__ . '/install/vendor/bin/composer', |
||
30 | ]); |
||
31 | $process->setTimeout(null); // Setting timeout to null to prevent installation from stopping at a certain point in time |
||
32 | $process->setWorkingDirectory(__DIR__)->mustRun(); |
||
33 | } catch (\Exception $ex) { |
||
34 | echo $ex->getMessage(); |
||
35 | } |
||
38 | } |