NonComposerComponentRegistration.php 863 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. //Register components (via a list of glob patterns)
  7. namespace Magento\NonComposerComponentRegistration;
  8. use RuntimeException;
  9. /**
  10. * Include files from a list of glob patterns
  11. *
  12. * @throws RuntimeException
  13. * @return void
  14. */
  15. function main()
  16. {
  17. $globPatterns = require __DIR__ . '/registration_globlist.php';
  18. $baseDir = dirname(dirname(__DIR__)) . '/';
  19. foreach ($globPatterns as $globPattern) {
  20. // Sorting is disabled intentionally for performance improvement
  21. $files = glob($baseDir . $globPattern, GLOB_NOSORT);
  22. if ($files === false) {
  23. throw new RuntimeException("glob(): error with '$baseDir$globPattern'");
  24. }
  25. array_map(function ($file) { require_once $file; }, $files);
  26. }
  27. }
  28. main();