Created
April 6, 2017 07:10
-
-
Save baumannsven/8be7efc297d33c92c3390d0e6864a7cf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
die ('This is not executable now! Please comment out this line.'); | |
$config = array( | |
'url' => 'https://getcomposer.org/composer.phar', | |
'dir' => __DIR__ . '/composer', | |
'bin' => __DIR__ . '/composer/composer.phar', | |
'json' => __DIR__ . '/composer/composer.json', | |
'command' => 'install' // The composer command update/install | |
); | |
error_reporting( | |
E_ALL & ~E_NOTICE & ~E_USER_NOTICE & ~E_DEPRECATED & ~E_USER_DEPRECATED | |
& ~E_WARNING & ~E_CORE_WARNING & ~E_USER_WARNING & ~E_STRICT | |
); | |
// Composer self update | |
copy($config['url'], $config['bin']); | |
require_once "phar://{$config['bin']}/src/bootstrap.php"; | |
chdir($config['dir']); | |
putenv("COMPOSER_HOME={$config['dir']}"); | |
putenv("OSTYPE=OS400"); //force to use php://output instead of php://stdout | |
$app = new \Composer\Console\Application(); | |
$factory = new \Composer\Factory(); | |
$output = $factory::createOutput(); | |
$input = new \Symfony\Component\Console\Input\ArrayInput( | |
array( | |
'command' => $config['command'], | |
) | |
); | |
$input->setInteractive(true); | |
echo "<pre>"; | |
$cmdret = $app->doRun($input, $output); //unfortunately ->run() call exit() so we use doRun() | |
echo "end!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment