composer 933 B

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