apps.php 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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) {
  9. if (strpos($path, 'integration')) {
  10. return;
  11. }
  12. if (strpos($path, 'Integration')) {
  13. return;
  14. }
  15. if ($dh = opendir($path)) {
  16. while ($name = readdir($dh)) {
  17. if ($name[0] !== '.') {
  18. $file = $path . '/' . $name;
  19. if (is_dir($file)) {
  20. loadDirectory($file);
  21. } elseif (substr($name, -4, 4) === '.php') {
  22. require_once $file;
  23. }
  24. }
  25. }
  26. }
  27. }
  28. function getSubclasses($parentClassName) {
  29. $classes = [];
  30. foreach (get_declared_classes() as $className) {
  31. if (is_subclass_of($className, $parentClassName)) {
  32. $classes[] = $className;
  33. }
  34. }
  35. return $classes;
  36. }
  37. $apps = OC_App::getEnabledApps();
  38. foreach ($apps as $app) {
  39. $dir = OC_App::getAppPath($app);
  40. if (is_dir($dir . '/tests')) {
  41. loadDirectory($dir . '/tests');
  42. }
  43. }