/** * processes the installer */ function process($argv) { // Determine ANSI output from --ansi and --no-ansi flags setUseAnsi($argv); if (in_array('--help', $argv)) { displayHelp(); exit(0); } $check = in_array('--check', $argv); $help = in_array('--help', $argv); $force = in_array('--force', $argv); $quiet = in_array('--quiet', $argv); $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable'); $disableTls = in_array('--disable-tls', $argv); $installDir = getOptValue('--install-dir', $argv, false); $version = getOptValue('--version', $argv, false); $filename = getOptValue('--filename', $argv, 'composer.phar'); $cafile = getOptValue('--cafile', $argv, false); if (!checkParams($installDir, $version, $cafile)) { exit(1); } $ok = checkPlatform($quiet, $disableTls); if (true === $disableTls) { out("You have instructed the Installer not to enforce SSL/TLS security on remote HTTPS requests.", 'info'); out("This will leave all downloads during installation vulnerable to Man-In-The-Middle (MITM) attacks.", 'info'); } if ($check) { exit($ok ? 0 : 1); } if ($ok || $force) { installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel); exit(0); } exit(1); }
/** * processes the installer */ function process($argv) { // Determine ANSI output from --ansi and --no-ansi flags setUseAnsi($argv); if (in_array('--help', $argv)) { displayHelp(); exit(0); } $check = in_array('--check', $argv); $help = in_array('--help', $argv); $force = in_array('--force', $argv); $quiet = in_array('--quiet', $argv); $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable'); $disableTls = in_array('--disable-tls', $argv); $installDir = getOptValue('--install-dir', $argv, false); $version = getOptValue('--version', $argv, false); $filename = getOptValue('--filename', $argv, 'composer.phar'); $cafile = getOptValue('--cafile', $argv, false); if (!checkParams($installDir, $version, $cafile)) { exit(1); } $ok = checkPlatform($warnings, $quiet, $disableTls); if ($check) { // Only show warnings if we haven't output any errors if ($ok) { showWarnings($warnings); showSecurityWarning($disableTls); } exit($ok ? 0 : 1); } if ($ok || $force) { installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel); showWarnings($warnings); showSecurityWarning($disableTls); exit(0); } exit(1); }