apps.php 931 B

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