load.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?php
  2. /**
  3. * This file is used to make all of Elgg's code available without going through
  4. * the boot process. Useful for internal testing purposes.
  5. *
  6. * @access private
  7. */
  8. $lib_dir = __DIR__ . "/lib";
  9. require_once "$lib_dir/autoloader.php";
  10. $autoload_path = dirname(__DIR__) . '/vendor/autoload.php';
  11. $autoload_available = include_once($autoload_path);
  12. if (!$autoload_available) {
  13. die("Couldn't include '$autoload_path'. Did you run `composer install`?");
  14. }
  15. // set up autoloading and DIC
  16. _elgg_services();
  17. // load the rest of the library files from engine/lib/
  18. // All on separate lines to make diffs easy to read + make it apparent how much
  19. // we're actually loading on every page (Hint: it's too much).
  20. $lib_files = array(
  21. // Needs to be loaded first to correctly bootstrap
  22. 'elgglib.php',
  23. // The order of these doesn't matter, so keep them alphabetical
  24. 'access.php',
  25. 'actions.php',
  26. 'admin.php',
  27. 'annotations.php',
  28. 'cache.php',
  29. 'comments.php',
  30. 'configuration.php',
  31. 'cron.php',
  32. 'database.php',
  33. 'entities.php',
  34. 'extender.php',
  35. 'filestore.php',
  36. 'friends.php',
  37. 'group.php',
  38. 'input.php',
  39. 'languages.php',
  40. 'mb_wrapper.php',
  41. 'memcache.php',
  42. 'metadata.php',
  43. 'metastrings.php',
  44. 'navigation.php',
  45. 'notification.php',
  46. 'objects.php',
  47. 'output.php',
  48. 'pagehandler.php',
  49. 'pageowner.php',
  50. 'pam.php',
  51. 'plugins.php',
  52. 'private_settings.php',
  53. 'relationships.php',
  54. 'river.php',
  55. 'sessions.php',
  56. 'sites.php',
  57. 'statistics.php',
  58. 'system_log.php',
  59. 'tags.php',
  60. 'user_settings.php',
  61. 'users.php',
  62. 'upgrade.php',
  63. 'views.php',
  64. 'widgets.php',
  65. // backward compatibility
  66. 'deprecated-1.7.php',
  67. 'deprecated-1.8.php',
  68. 'deprecated-1.9.php',
  69. 'deprecated-1.10.php',
  70. 'deprecated-1.11.php',
  71. 'deprecated-1.12.php',
  72. );
  73. // isolate global scope
  74. call_user_func(function () use ($lib_dir, $lib_files) {
  75. $setups = array();
  76. // include library files, capturing setup functions
  77. foreach ($lib_files as $file) {
  78. $setup = (require_once "$lib_dir/$file");
  79. if ($setup instanceof Closure) {
  80. $setups[$file] = $setup;
  81. }
  82. }
  83. $events = _elgg_services()->events;
  84. $hooks = _elgg_services()->hooks;
  85. // run setups
  86. foreach ($setups as $func) {
  87. $func($events, $hooks);
  88. }
  89. });