composer 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env php
  2. <?php
  3. require __DIR__.'/../src/bootstrap.php';
  4. use Composer\Console\Application;
  5. error_reporting(-1);
  6. if (function_exists('ini_set')) {
  7. @ini_set('display_errors', 1);
  8. $memoryInBytes = function ($value) {
  9. $unit = strtolower(substr($value, -1, 1));
  10. $value = (int) $value;
  11. switch($unit) {
  12. case 'g':
  13. $value *= 1024;
  14. // no break (cumulative multiplier)
  15. case 'm':
  16. $value *= 1024;
  17. // no break (cumulative multiplier)
  18. case 'k':
  19. $value *= 1024;
  20. }
  21. return $value;
  22. };
  23. $memoryLimit = trim(ini_get('memory_limit'));
  24. // Increase memory_limit if it is lower than 512M
  25. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 512 * 1024 * 1024) {
  26. @ini_set('memory_limit', '512M');
  27. }
  28. unset($memoryInBytes, $memoryLimit);
  29. }
  30. // run the command application
  31. $application = new Application();
  32. $application->run();