1
0

apps.php 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. function loadDirectory($path): void {
  9. if (strpos($path, 'integration')) {
  10. return;
  11. }
  12. if (strpos($path, 'Integration')) {
  13. return;
  14. }
  15. if (! $dh = opendir($path)) {
  16. return;
  17. }
  18. while ($name = readdir($dh)) {
  19. if ($name[0] === '.') {
  20. continue;
  21. }
  22. $file = $path . '/' . $name;
  23. if (is_dir($file)) {
  24. loadDirectory($file);
  25. } elseif (str_ends_with($name, '.php')) {
  26. require_once $file;
  27. }
  28. }
  29. }
  30. function getSubclasses($parentClassName): array {
  31. $classes = [];
  32. foreach (get_declared_classes() as $className) {
  33. if (is_subclass_of($className, $parentClassName)) {
  34. $classes[] = $className;
  35. }
  36. }
  37. return $classes;
  38. }
  39. $apps = OC_App::getEnabledApps();
  40. foreach ($apps as $app) {
  41. $dir = OC_App::getAppPath($app);
  42. if (is_dir($dir . '/tests')) {
  43. loadDirectory($dir . '/tests');
  44. }
  45. }